bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#8154: du: issue with `--files0-from=DIR'


From: Paul Eggert
Subject: bug#8154: du: issue with `--files0-from=DIR'
Date: Wed, 02 Mar 2011 09:10:32 -0800
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Thunderbird/3.1.7

On 03/02/2011 07:09 AM, Jim Meyering wrote:
-  struct argv_iterator *ai = malloc (sizeof *ai);
+  struct argv_iterator *ai;
+  struct stat st;
+
+  if (fstat (fileno (fp),&st) == 0&&  S_ISDIR (st.st_mode))
+    {
+      errno = EISDIR;
+      return NULL;
+    }
+
+  ai = malloc (sizeof *ai);

My kneejerk reaction is that this part of the patch
should not be needed (though other fixes obviously are).
There are lots of reasons that the stream could fail:
why check for directories specially?  Just let the
stream fail in the way that it normally would; this
keeps the code smaller and simpler.  On an ancient
host where "cat dir/" works, "du --files0-from=dir/"
should not arbitrarily fail.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]