diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2005-04-11 20:09:01 +0000 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2005-04-11 20:09:01 +0000 |
commit | ab860aae655108056d9260cff959274ae6f4c7dd (patch) | |
tree | e6e3cf8728e08ce174fbc76b49e51c6dd8e02403 /src | |
parent | 8e14d7ffbb0f95f3cd28df437ea49291074fe0a9 (diff) | |
download | coreutils-ab860aae655108056d9260cff959274ae6f4c7dd.tar.xz |
(check_and_close): Don't assume fopen does not return stdin.
Diffstat (limited to 'src')
-rw-r--r-- | src/od.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -240,7 +240,7 @@ static size_t n_specs_allocated; static size_t bytes_per_block; /* Human-readable representation of *file_list (for error messages). - It differs from *file_list only when *file_list is "-". */ + It differs from file_list[-1] only when file_list[-1] is "-". */ static char const *input_filename; /* A NULL-terminated list of the file-arguments from the command line. */ @@ -937,11 +937,11 @@ check_and_close (int in_errno) if (ferror (in_stream)) { error (0, in_errno, _("%s: read error"), input_filename); - if (in_stream != stdin) + if (! STREQ (file_list[-1], "-")) fclose (in_stream); ok = false; } - else if (in_stream != stdin && fclose (in_stream) == EOF) + else if (! STREQ (file_list[-1], "-") && fclose (in_stream) != 0) { error (0, errno, "%s", input_filename); ok = false; |