-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Now that cygwin 1.7.1 has been released as a stable version, I'm pushing this (the problem has already been fixed in CVS, so cygwin 1.7.2 will not need it). I verified that my pending patches for signature_check fail as follows without this patch:
gcc -DHAVE_CONFIG_H -I. -I../../gltests -I. -I../../gltests -I.. - -I../../gltests/.. -I../gllib -I../../gltests/../gllib -g -O2 -MT test-unlinkat.o -MD -MP -MF .deps/test-unlinkat.Tpo -c -o test-unlinkat.o ../../gltests/test-unlinkat.c ../../gltests/test-unlinkat.c:24: error: ‘unlinkat’ undeclared here (not in a function) Hmm, looking at it further, it looks like we need to make all of our conditional #includes in the *.in.h files also be activated if GNULIB_POSIXCHECK is defined. I'll work on a followup patch for that. - -- Don't work too hard, make some time for fun as well! Eric Blake e...@byu.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAksy61kACgkQ84KuGfSFAYAo0ACdG/MG/H6/uKFy1cuSP7CRhX7H jR8AoJx6+NyfDkOMdG3zo4ujoCM5pT1c =37gT -----END PGP SIGNATURE-----
From 86c22b430f2922f15533117d0e21dbe7d5898d39 Mon Sep 17 00:00:00 2001 From: Eric Blake <e...@byu.net> Date: Wed, 23 Dec 2009 18:42:59 -0700 Subject: [PATCH] unistd: work around cygwin bug Cygwin 1.7.1 placed symlinkat and unlinkat in the wrong headers (due to a bug in the Linux man pages). * lib/unistd.in.h (includes): Pick up headers needed for cygwin. * doc/posix-functions/unlinkat.texi (unlinkat): Document the bug. * doc/posix-functions/symlinkat.texi (symlinkat): Likewise. Signed-off-by: Eric Blake <e...@byu.net> --- ChangeLog | 7 +++++++ doc/posix-functions/symlinkat.texi | 4 ++++ doc/posix-functions/unlinkat.texi | 4 ++++ lib/unistd.in.h | 9 ++++++++- 4 files changed, 23 insertions(+), 1 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2133dc5..8c4fe25 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-12-23 Eric Blake <e...@byu.net> + + unistd: work around cygwin bug + * lib/unistd.in.h (includes): Pick up headers needed for cygwin. + * doc/posix-functions/unlinkat.texi (unlinkat): Document the bug. + * doc/posix-functions/symlinkat.texi (symlinkat): Likewise. + 2009-12-23 Bruno Haible <br...@clisp.org> localename: More tests. diff --git a/doc/posix-functions/symlinkat.texi b/doc/posix-functions/symlinkat.texi index d5ef9dc..32760a4 100644 --- a/doc/posix-functions/symlinkat.texi +++ b/doc/posix-functions/symlinkat.texi @@ -13,6 +13,10 @@ symlinkat glibc 2.3.6, MacOS X 10.3, FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x, mingw, Interix 3.5, BeOS. But the replacement function is not safe to be used in libraries and is not multithread-safe. +...@item +Some platforms declare this function in @code{stdio.h} instead of +...@code{unistd.h}: +Cygwin 1.7.1. @end itemize Portability problems not fixed by Gnulib: diff --git a/doc/posix-functions/unlinkat.texi b/doc/posix-functions/unlinkat.texi index 1ec724e..cf33409 100644 --- a/doc/posix-functions/unlinkat.texi +++ b/doc/posix-functions/unlinkat.texi @@ -16,6 +16,10 @@ unlinkat @item Some systems mistakenly succeed on @code{unlinkat(fd,"file/",flag)}: GNU/Hurd, Solaris 9. +...@item +Some platforms declare this function in @code{fcntl.h} instead of +...@code{unistd.h}: +Cygwin 1.7.1. @end itemize Portability problems not fixed by Gnulib: diff --git a/lib/unistd.in.h b/lib/unistd.in.h index a3a49ed..d0188f5 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -33,10 +33,17 @@ #include <stddef.h> /* mingw doesn't define the SEEK_* or *_FILENO macros in <unistd.h>. */ -#if !(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) +/* Cygwin 1.7.1 declares symlinkat in <stdio.h>, not in <unistd.h>. */ +#if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \ + || @GNULIB_SYMLINKAT@) # include <stdio.h> #endif +/* Cygwin 1.7.1 declares unlinkat in <fcntl.h>, not in <unistd.h>. */ +#if @GNULIB_UNLINKAT@ +# include <fcntl.h> +#endif + /* mingw fails to declare _exit in <unistd.h>. */ /* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>. */ /* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */ -- 1.6.4.2