diff options
author | Jim Meyering <jim@meyering.net> | 1995-10-27 15:12:31 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1995-10-27 15:12:31 +0000 |
commit | ca59b76b50211f6a93a9f0e439bc787de98803da (patch) | |
tree | d9b28af8a6b09a6cffa08e7b193fdbc1d677cccc /src | |
parent | b9485b8d524faf4cc22bc44901464f13e79536ea (diff) | |
download | coreutils-ca59b76b50211f6a93a9f0e439bc787de98803da.tar.xz |
(batch_convert): Close input stream also when it's not stdin.
Diffstat (limited to 'src')
-rw-r--r-- | src/date.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/date.c b/src/date.c index 5e32afa4d..51772b179 100644 --- a/src/date.c +++ b/src/date.c @@ -82,7 +82,6 @@ batch_convert (input_filename, format) const char *input_filename; const char *format; { - int have_read_stdin; int status; FILE *in_stream; char *line; @@ -94,7 +93,6 @@ batch_convert (input_filename, format) { input_filename = _("standard input"); in_stream = stdin; - have_read_stdin = 1; } else { @@ -103,7 +101,6 @@ batch_convert (input_filename, format) { error (0, errno, "%s", input_filename); } - have_read_stdin = 0; } line = NULL; @@ -132,8 +129,8 @@ batch_convert (input_filename, format) } } - if (have_read_stdin && fclose (stdin) == EOF) - error (2, errno, _("standard input")); + if (fclose (in_stream) == EOF) + error (2, errno, input_filename); if (line != NULL) free (line); |