Pádraig Brady wrote:
> On 02/03/11 17:10, Paul Eggert wrote:
>> 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.
>
> I thought that at first too, but it seems like
> it might cause more issues that not, by allowing it?
> Testing bsd here shows that valid NUL terminated file names
> are returned, but also there is other info interspersed.

I'm planning to skip the new tests when "cat some-dir" succeeds.

Reply via email to