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 [email protected] +1-801-349-2682 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
