bug-gnulib
[Top][All Lists]
Advanced

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

Re: dirfd, mingw, errno


From: Bruno Haible
Subject: Re: dirfd, mingw, errno
Date: Sat, 7 Feb 2009 11:45:45 +0100
User-agent: KMail/1.9.9

Jim Meyering wrote:
> Subject: [PATCH] dirfd: set errno upon failure
> 
> * lib/dirfd.c: Include <errno.h>.
> Set errno to ENOTSUP when returning -1.
> * modules/dirfd (Depends-on): Add errno.
> Suggested by John Kodis <address@hidden>.

This behaviour of dirfd is more than POSIX requires. POSIX only says that
"Otherwise, it" [the dirfd function] "shall return -1 and may set errno to
indicate the error."

I verified that most platforms which already have a dirfd macro or function
verify the stricter requirement: glibc 2.3.6, MacOS X 10.3, FreeBSD 6.0,
NetBSD 3.0, OpenBSD 3.8, IRIX 6.5. (I don't care about BeOS and Interix at
this point.)

Still, this extension to POSIX should be documented, since another module
(fts) relies on it. I'm applying this:


2009-02-07  Bruno Haible  <address@hidden>

        * doc/posix-functions/dirfd.texi: Clarify situation on mingw. Document
        failure behaviour.

--- doc/posix-functions/dirfd.texi.orig 2009-02-07 11:38:40.000000000 +0100
+++ doc/posix-functions/dirfd.texi      2009-02-07 11:37:09.000000000 +0100
@@ -10,12 +10,16 @@
 @itemize
 @item
 This function is missing on some platforms:
-AIX 5.1, HP-UX 11, OSF/1 5.1, Solaris 10.
+AIX 5.1, HP-UX 11, OSF/1 5.1, Solaris 10, mingw.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
 @item
-This function is missing on some platforms:
+This function always fails on some platforms:
 mingw.
 @end itemize
+
+With the @code{dirfd} module, this functions always sets @code{errno} when it
+fails. (POSIX does not require that @code{dirfd} sets @code{errno} when it
+fails.)




reply via email to

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