diff options
author | Tijl Coosemans <tijl@FreeBSD.org> | 2024-01-22 10:35:31 +0000 |
---|---|---|
committer | Tijl Coosemans <tijl@FreeBSD.org> | 2024-01-31 09:19:00 +0000 |
commit | 085ab2c143eb5192ea18b8dd52bd8fa69c9f2d06 (patch) | |
tree | 03c34c22778e4c12aad5ab2f9e5a94a8f2c5bb10 | |
parent | 1b70e4f53bde13988c1b0cf8014484d00d062440 (diff) | |
download | src-085ab2c143eb5192ea18b8dd52bd8fa69c9f2d06.tar.gz src-085ab2c143eb5192ea18b8dd52bd8fa69c9f2d06.zip |
join(1): Fix ordering in case of missing fields
The comparison function had the ordering reversed causing join(1) to
miss some matching lines.
PR: 232405
Submitted by: Martijn van Duren <martijn@openbsd.org>
(cherry picked from commit 95bf75895ddcf17402b1f69dce26cb821c922476)
-rw-r--r-- | usr.bin/join/join.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/join/join.c b/usr.bin/join/join.c index 35b327c89ee4..c4bd42728fa7 100644 --- a/usr.bin/join/join.c +++ b/usr.bin/join/join.c @@ -392,9 +392,9 @@ static int cmp(LINE *lp1, u_long fieldno1, LINE *lp2, u_long fieldno2) { if (lp1->fieldcnt <= fieldno1) - return (lp2->fieldcnt <= fieldno2 ? 0 : 1); + return (lp2->fieldcnt <= fieldno2 ? 0 : -1); if (lp2->fieldcnt <= fieldno2) - return (-1); + return (1); return (mbscoll(lp1->fields[fieldno1], lp2->fields[fieldno2])); } |