diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2003-07-27 18:45:56 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2003-07-27 18:45:56 +0000 |
commit | 01ad46a801b8d06bb042bac1a5a17c217bc8931c (patch) | |
tree | 07d29bfcf5810a9567acc86336f5eb30f0a32313 /usr.bin/diff | |
parent | 7419eb8e234edfa43124535ebdff318e322b9aa9 (diff) |
Correct computation of argsize when setting diffargs.
Diffstat (limited to 'usr.bin/diff')
-rw-r--r-- | usr.bin/diff/diff.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/diff/diff.c b/usr.bin/diff/diff.c index 56b11e3da95..0338b7ec00c 100644 --- a/usr.bin/diff/diff.c +++ b/usr.bin/diff/diff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diff.c,v 1.35 2003/07/27 07:39:52 otto Exp $ */ +/* $OpenBSD: diff.c,v 1.36 2003/07/27 18:45:55 millert Exp $ */ /* * Copyright (c) 2003 Todd C. Miller <Todd.Miller@courtesan.com> @@ -21,7 +21,7 @@ */ #ifndef lint -static const char rcsid[] = "$OpenBSD: diff.c,v 1.35 2003/07/27 07:39:52 otto Exp $"; +static const char rcsid[] = "$OpenBSD: diff.c,v 1.36 2003/07/27 18:45:55 millert Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -207,7 +207,7 @@ main(int argc, char **argv) err(2, "%s", argv[1]); if (gotstdin && (S_ISDIR(stb1.st_mode) || S_ISDIR(stb2.st_mode))) errx(2, "can't compare - to a directory"); - set_argstr(oargv, argv); + set_argstr(oargv + 1, argv); if (S_ISDIR(stb1.st_mode) && S_ISDIR(stb2.st_mode)) { if (format == D_IFDEF) errx(2, "-D option not supported with directories"); @@ -270,7 +270,7 @@ set_argstr(char **av, char **ave) size_t argsize; char **ap; - argsize = 4 + (char *)ave - (char *)av + 1; + argsize = 4 + *ave - *av + 1; diffargs = emalloc(argsize); strlcpy(diffargs, "diff", argsize); for (ap = av + 1; ap < ave; ap++) { |