summaryrefslogtreecommitdiff
path: root/usr.bin/sort
diff options
context:
space:
mode:
authorRay Lai <ray@cvs.openbsd.org>2006-11-16 00:14:35 +0000
committerRay Lai <ray@cvs.openbsd.org>2006-11-16 00:14:35 +0000
commit92f8eae34fb3c6dd9dfd43515f7f8de4f9be5a80 (patch)
tree2202a528fadebe723c9da372b2df31edbf000073 /usr.bin/sort
parenta10f6190ba6db430fc9e77272b10ed18102691a2 (diff)
Fix undefined behavior (var = ++var).
From Alexey Dobriyan <adobriyan at gmail dot com>. OK otto@, moritz@, and jaredy@.
Diffstat (limited to 'usr.bin/sort')
-rw-r--r--usr.bin/sort/init.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/sort/init.c b/usr.bin/sort/init.c
index 2cf8c1a9ebd..31049abbdcd 100644
--- a/usr.bin/sort/init.c
+++ b/usr.bin/sort/init.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init.c,v 1.8 2005/04/11 07:12:03 deraadt Exp $ */
+/* $OpenBSD: init.c,v 1.9 2006/11/16 00:14:34 ray Exp $ */
/*-
* Copyright (c) 1993
@@ -36,7 +36,7 @@
#if 0
static char sccsid[] = "@(#)init.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: init.c,v 1.8 2005/04/11 07:12:03 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: init.c,v 1.9 2006/11/16 00:14:34 ray Exp $";
#endif
#endif /* not lint */
@@ -123,7 +123,8 @@ setcolumn(char *pos, struct field *cur_fld, int gflag)
if (*pos == '.') {
if (!col->num)
errx(2, "cannot indent end of line");
- pos += sscanf(++pos, "%d", &(col->indent));
+ pos++;
+ pos += sscanf(pos, "%d", &(col->indent));
while (isdigit(*pos))
pos++;
if (&cur_fld->icol == col)