summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2005-04-11 20:09:01 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2005-04-11 20:09:01 +0000
commitab860aae655108056d9260cff959274ae6f4c7dd (patch)
treee6e3cf8728e08ce174fbc76b49e51c6dd8e02403 /src
parent8e14d7ffbb0f95f3cd28df437ea49291074fe0a9 (diff)
downloadcoreutils-ab860aae655108056d9260cff959274ae6f4c7dd.tar.xz
(check_and_close): Don't assume fopen does not return stdin.
Diffstat (limited to 'src')
-rw-r--r--src/od.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/od.c b/src/od.c
index f57eb1a14..b55e7d3eb 100644
--- a/src/od.c
+++ b/src/od.c
@@ -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;