From c2377708ecb536e6bc30997a3b9b01b48d38ea5e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 11 Apr 2005 20:09:22 +0000 Subject: (paste_serial): Don't assume fopen does not return stdin. --- src/paste.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/paste.c b/src/paste.c index 139ac599a..8f51c521c 100644 --- a/src/paste.c +++ b/src/paste.c @@ -336,7 +336,8 @@ paste_serial (size_t nfiles, char **fnamptr) for (; nfiles; nfiles--, fnamptr++) { int saved_errno; - if (STREQ (*fnamptr, "-")) + bool is_stdin = STREQ (*fnamptr, "-"); + if (is_stdin) { have_read_stdin = true; fileptr = stdin; @@ -394,7 +395,7 @@ paste_serial (size_t nfiles, char **fnamptr) error (0, saved_errno, "%s", *fnamptr); ok = false; } - if (fileptr == stdin) + if (is_stdin) clearerr (fileptr); /* Also clear EOF. */ else if (fclose (fileptr) == EOF) { -- cgit v1.2.3-70-g09d2