mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-17 18:02:09 +03:00
(paste_serial): Don't assume fopen does not return stdin.
This commit is contained in:
1 parent
ab860aae65
commit
c2377708ec
1 file changed
+3
-2
+3
-2
@@ -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)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user