[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: freebsd-8.1 fails fdopendir test
From: |
Jim Meyering |
Subject: |
Re: freebsd-8.1 fails fdopendir test |
Date: |
Fri, 04 Feb 2011 18:51:16 +0100 |
Eric Blake wrote:
> On 02/04/2011 07:34 AM, Jim Meyering wrote:
>> Given this code from test-fdopendir.c, FreeBSD 8.1 fails
>>
>> int
>> main (void)
>> {
>> DIR *d;
>> int fd;
>>
>> /* A non-directory cannot be turned into a directory stream. */
>> fd = open ("test-fdopendir.tmp", O_RDONLY | O_CREAT, 0600);
>> ASSERT (0 <= fd);
>> errno = 0;
>> ASSERT (fdopendir (fd) == NULL);
>> ASSERT (errno == ENOTDIR);
>> ASSERT (close (fd) == 0);
>> ...
>>
>> because the close returns nonzero.
>> It sets errno to EBADF.
>>
>> It's pretty obvious that this is a bug.
>
> Sounds like FreeBSD is nuking fd as part of fdopendir(), even though fd
Exactly (a bug in FreeBSD's fdopendir, not the test).
This is such an odd corner I suspect they never bothered to test it.
> should be left alone. I can probably work around it (after confirming
> on an actual FreeBSD machine if my assumption is correct), but it won't
> be in time for coreutils 8.10.
>
>>
>> This is probably not relevant to coreutils,
>> (I don't think it can be made to call fdopendir on a non-dir FD)
>> so addressing it is not urgent.
>
> Agreed on the non-urgency.