summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2005-04-11 20:07:22 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2005-04-11 20:07:22 +0000
commitcc4407f0fe07e25dab4aeef1a972401a15de047e (patch)
treec0266db6ba181b086f6f00dbc17b8d09482df74d /src
parent329448f75ed82c1ff44ab28c05f16ef7ad17d4bc (diff)
downloadcoreutils-cc4407f0fe07e25dab4aeef1a972401a15de047e.tar.xz
(dc_parse_file): Don't assume fopen does not return stdin.
Diffstat (limited to 'src')
-rw-r--r--src/dircolors.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/dircolors.c b/src/dircolors.c
index 5f9df114d..1253980d0 100644
--- a/src/dircolors.c
+++ b/src/dircolors.c
@@ -376,8 +376,9 @@ dc_parse_file (const char *filename)
{
FILE *fp;
bool ok;
+ bool is_stdin = STREQ (filename, "-");
- if (STREQ (filename, "-"))
+ if (is_stdin)
{
have_read_stdin = true;
fp = stdin;
@@ -398,7 +399,7 @@ dc_parse_file (const char *filename)
ok = dc_parse_stream (fp, filename);
- if (fp != stdin && fclose (fp) == EOF)
+ if (!is_stdin && fclose (fp) != 0)
{
error (0, errno, "%s", quote (filename));
return false;