diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2005-04-11 20:09:22 +0000 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2005-04-11 20:09:22 +0000 |
commit | c2377708ecb536e6bc30997a3b9b01b48d38ea5e (patch) | |
tree | 4b961e7b59f35730c80b03312963dc0373b3e700 /src | |
parent | ab860aae655108056d9260cff959274ae6f4c7dd (diff) | |
download | coreutils-c2377708ecb536e6bc30997a3b9b01b48d38ea5e.tar.xz |
(paste_serial): Don't assume fopen does not return stdin.
Diffstat (limited to 'src')
-rw-r--r-- | src/paste.c | 5 |
1 files changed, 3 insertions, 2 deletions
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) { |