From b1a26502ca1617077b203ef01ad66e12a3048825 Mon Sep 17 00:00:00 2001 From: millert Date: Tue, 8 Jul 2003 04:45:32 +0000 Subject: 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 --- usr.bin/diff/diff.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'usr.bin/diff/diff.c') 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 @@ -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 @@ -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]); -- cgit v1.2.3-59-g8ed1b