summaryrefslogtreecommitdiff
path: root/src/paste.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2005-04-11 20:09:22 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2005-04-11 20:09:22 +0000
commitc2377708ecb536e6bc30997a3b9b01b48d38ea5e (patch)
tree4b961e7b59f35730c80b03312963dc0373b3e700 /src/paste.c
parentab860aae655108056d9260cff959274ae6f4c7dd (diff)
downloadcoreutils-c2377708ecb536e6bc30997a3b9b01b48d38ea5e.tar.xz
(paste_serial): Don't assume fopen does not return stdin.
Diffstat (limited to 'src/paste.c')
-rw-r--r--src/paste.c5
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)
{