mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-17 18:02:09 +03:00
(batch_convert): Close input stream also when it's not stdin.
This commit is contained in:
1 parent
b9485b8d52
commit
ca59b76b50
1 file changed
+2
-5
+2
-5
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user