diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2005-12-27 04:28:09 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2005-12-27 04:28:09 +0000 |
commit | cacce888d68a00565b85a2cb5f1f7fa03eae9de0 (patch) | |
tree | c6bff5ee912673863dbee98a3668e382ca1154b9 /usr.bin | |
parent | d9ebf8a9a239c6e22f8fbe18524757e4a8e47278 (diff) |
remove broken assert on argc, and put argc check in right place
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/sdiff/edit.c | 4 | ||||
-rw-r--r-- | usr.bin/sdiff/sdiff.c | 17 |
2 files changed, 9 insertions, 12 deletions
diff --git a/usr.bin/sdiff/edit.c b/usr.bin/sdiff/edit.c index 690542d5bb6..ce050846d91 100644 --- a/usr.bin/sdiff/edit.c +++ b/usr.bin/sdiff/edit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: edit.c,v 1.3 2005/12/27 04:18:07 tedu Exp $ */ +/* $OpenBSD: edit.c,v 1.4 2005/12/27 04:28:08 tedu Exp $ */ /* * Written by Raymond Lai <ray@cyth.net>. @@ -244,7 +244,7 @@ RIGHT: warn("could not close: %s", filename); /* filename was malloc()ed in xmktemp(). */ - free(filename); + free((void *)filename); return (0); } diff --git a/usr.bin/sdiff/sdiff.c b/usr.bin/sdiff/sdiff.c index c91ac51b046..57d26dcc558 100644 --- a/usr.bin/sdiff/sdiff.c +++ b/usr.bin/sdiff/sdiff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sdiff.c,v 1.3 2005/12/27 04:18:07 tedu Exp $ */ +/* $OpenBSD: sdiff.c,v 1.4 2005/12/27 04:28:08 tedu Exp $ */ /* * Written by Raymond Lai <ray@cyth.net>. @@ -93,7 +93,6 @@ main(int argc, char **argv) const char *cmd, **diffargv, *diffprog; /* Initialize variables. */ - Dflag = lflag = sflag = 0; diffargc = 0; diffprog = "diff"; outfile = NULL; @@ -141,7 +140,7 @@ main(int argc, char **argv) diffargv[diffargc++] = "-E"; break; case 'F': - diffprog = optarg; + diffargv[0] = diffprog = optarg; break; case 'H': diffargv[diffargc++] = "-H"; @@ -183,12 +182,15 @@ main(int argc, char **argv) /* NOTREACHED */ } - /* Don't exceed buffer after adding file1, file2, and NULL. */ - assert(diffargc + 3 <= argc_max); } argc -= optind; argv += optind; + if (argc != 2) { + usage(); + /* NOTREACHED */ + } + /* file1 */ diffargv[diffargc++] = argv[0]; /* file2 */ @@ -205,11 +207,6 @@ main(int argc, char **argv) errx(2, "width is too large: %zu", width); line_width = width * 2 + 3; - if (argc != 2) { - usage(); - /* NOTREACHED */ - } - if (pipe(fd)) err(2, "pipe"); |