summaryrefslogtreecommitdiff
path: root/src/du.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2005-08-27 18:12:54 +0000
committerJim Meyering <jim@meyering.net>2005-08-27 18:12:54 +0000
commit509e46c548dd3e62c107a7b2c0c14e2ed206b2bf (patch)
tree53a438cd77963e72cab3cb092392d253314e4ad8 /src/du.c
parent21e8dcda495af6119a7a75fd213acf0d6f831075 (diff)
downloadcoreutils-509e46c548dd3e62c107a7b2c0c14e2ed206b2bf.tar.xz
Revert the du.c part of the change from 2005-07-02:
That change (to reopen stdin on F for --files0-from=F) made it so --exclude-from=- and --files0-from=F would not work together.
Diffstat (limited to 'src/du.c')
-rw-r--r--src/du.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/du.c b/src/du.c
index df5088e30..a8fb2ed10 100644
--- a/src/du.c
+++ b/src/du.c
@@ -928,6 +928,8 @@ main (int argc, char **argv)
if (files_from)
{
+ FILE *istream;
+
/* When using --files0-from=F, you may not specify any files
on the command-line. */
if (optind < argc)
@@ -938,13 +940,14 @@ main (int argc, char **argv)
usage (EXIT_FAILURE);
}
- if (! (STREQ (files_from, "-") || freopen (files_from, "r", stdin)))
+ istream = (STREQ (files_from, "-") ? stdin : fopen (files_from, "r"));
+ if (istream == NULL)
error (EXIT_FAILURE, errno, _("cannot open %s for reading"),
quote (files_from));
readtokens0_init (&tok);
- if (! readtokens0 (stdin, &tok) || fclose (stdin) != 0)
+ if (! readtokens0 (istream, &tok) || fclose (istream) != 0)
error (EXIT_FAILURE, 0, _("cannot read file names from %s"),
quote (files_from));