[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: freebsd-8.1 fails fdopendir test
From: |
Eric Blake |
Subject: |
Re: freebsd-8.1 fails fdopendir test |
Date: |
Fri, 04 Feb 2011 10:44:59 -0700 |
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 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.7 |
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
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.
--
Eric Blake address@hidden +1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature