summaryrefslogtreecommitdiffstats
path: root/usr.bin/diff/diffreg.c
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2003-07-31 02:53:57 +0000
committermillert <millert@openbsd.org>2003-07-31 02:53:57 +0000
commitf28259e9bfdc4a8ed2bc2df0bccf8f9dab5d6a41 (patch)
tree4bd54b0459f1f7c5eb1ffed5fab5f442b345a8fe /usr.bin/diff/diffreg.c
parentsync (diff)
downloadwireguard-openbsd-f28259e9bfdc4a8ed2bc2df0bccf8f9dab5d6a41.tar.xz
wireguard-openbsd-f28259e9bfdc4a8ed2bc2df0bccf8f9dab5d6a41.zip
o correct exit code when comparing stdin and stdin (a noop)
o after copying to a temp file, lseek() to the beginning so the inline cmp routine works. Fixes an exit code issue when comparing against stdin.
Diffstat (limited to 'usr.bin/diff/diffreg.c')
-rw-r--r--usr.bin/diff/diffreg.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c
index 86237b1cb9c..9855ff61d95 100644
--- a/usr.bin/diff/diffreg.c
+++ b/usr.bin/diff/diffreg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diffreg.c,v 1.45 2003/07/29 18:38:47 deraadt Exp $ */
+/* $OpenBSD: diffreg.c,v 1.46 2003/07/31 02:53:57 millert Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
@@ -65,7 +65,7 @@
*/
#ifndef lint
-static const char rcsid[] = "$OpenBSD: diffreg.c,v 1.45 2003/07/29 18:38:47 deraadt Exp $";
+static const char rcsid[] = "$OpenBSD: diffreg.c,v 1.46 2003/07/31 02:53:57 millert Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -297,7 +297,7 @@ diffreg(char *ofile1, char *ofile2, int flags)
if (S_ISDIR(stb1.st_mode) != S_ISDIR(stb2.st_mode))
return (S_ISDIR(stb1.st_mode) ? D_MISMATCH1 : D_MISMATCH2);
if (strcmp(file1, "-") == 0 && strcmp(file2, "-") == 0)
- goto notsame;
+ goto closem;
if (flags & D_EMPTY1)
f1 = fopen(_PATH_DEVNULL, "r");
@@ -352,7 +352,6 @@ diffreg(char *ofile1, char *ofile2, int flags)
goto closem;
}
-notsame:
/*
* Files certainly differ at this point; set status accordingly
*/
@@ -520,6 +519,7 @@ opentemp(const char *file)
}
}
close(ifd);
+ lseek(ofd, (off_t)0, SEEK_SET);
return (fdopen(ofd, "r"));
}