summaryrefslogtreecommitdiffstats
path: root/usr.bin/diff/diff.c
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2003-07-08 04:45:32 +0000
committermillert <millert@openbsd.org>2003-07-08 04:45:32 +0000
commitb1a26502ca1617077b203ef01ad66e12a3048825 (patch)
treef7307b9e52a165ebc31f39d5ceed2fa733341358 /usr.bin/diff/diff.c
parentdont silently truncate a domain socket specified via the -p argument; (diff)
downloadwireguard-openbsd-b1a26502ca1617077b203ef01ad66e12a3048825.tar.xz
wireguard-openbsd-b1a26502ca1617077b203ef01ad66e12a3048825.zip
o Avoid a temp file if using stdin and stdin is redirected from a regular file
o Fix a double free in the temmp file case
Diffstat (limited to 'usr.bin/diff/diff.c')
-rw-r--r--usr.bin/diff/diff.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/diff/diff.c b/usr.bin/diff/diff.c
index afd54bdf271..6d497053d6c 100644
--- a/usr.bin/diff/diff.c
+++ b/usr.bin/diff/diff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff.c,v 1.25 2003/07/06 22:17:21 millert Exp $ */
+/* $OpenBSD: diff.c,v 1.26 2003/07/08 04:45:32 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.25 2003/07/06 22:17:21 millert Exp $";
+static const char rcsid[] = "$OpenBSD: diff.c,v 1.26 2003/07/08 04:45:32 millert Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -176,12 +176,12 @@ main(int argc, char **argv)
if (argc != 2)
usage();
if (strcmp(argv[0], "-") == 0) {
- stb1.st_mode = S_IFREG;
+ fstat(STDIN_FILENO, &stb1);
gotstdin = 1;
} else if (stat(argv[0], &stb1) != 0)
error("%s", argv[0]);
if (strcmp(argv[1], "-") == 0) {
- stb2.st_mode = S_IFREG;
+ fstat(STDIN_FILENO, &stb2);
gotstdin = 1;
} else if (stat(argv[1], &stb2) != 0)
error("%s", argv[1]);