diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-12-22 19:02:56 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-12-22 19:02:56 +0000 |
commit | 383723742c7c0db962ff099594744e1cf6ed8932 (patch) | |
tree | 898736530488f9ae155e0f42ec05cb862fe53577 /usr.bin/join | |
parent | 9be72de4a071fb27fc67ab9c1bd5489e29d27844 (diff) |
fieldcnt is number of fields, not +1; from mouse@Collatz.McRCIM.McGill.EDU; netbsd pr#1356
Diffstat (limited to 'usr.bin/join')
-rw-r--r-- | usr.bin/join/join.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/join/join.c b/usr.bin/join/join.c index 7879ca2e751..01fe89580c6 100644 --- a/usr.bin/join/join.c +++ b/usr.bin/join/join.c @@ -43,7 +43,7 @@ char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)join.c 5.1 (Berkeley) 11/18/91";*/ -static char rcsid[] = "$Id: join.c,v 1.1 1995/10/18 08:45:26 deraadt Exp $"; +static char rcsid[] = "$Id: join.c,v 1.2 1995/12/22 19:02:55 deraadt Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -356,9 +356,9 @@ cmp(lp1, fieldno1, lp2, fieldno2) LINE *lp1, *lp2; u_long fieldno1, fieldno2; { - if (lp1->fieldcnt < fieldno1) + if (fieldno1 >= lp1->fieldcnt) return (lp2->fieldcnt < fieldno2 ? 0 : 1); - if (lp2->fieldcnt < fieldno2) + if (fieldno2 >= lp2->fieldcnt) return (-1); return (strcmp(lp1->fields[fieldno1], lp2->fields[fieldno2])); } |