+2012-11-08 Paul Eggert <eggert@cs.ucla.edu>
+
+ fcntl-h: default O_SEARCH, O_EXEC back to O_RDONLY
+ O_PATH doesn't work with Linux kernel 3.6.5, as fchmod (fd, ...)
+ fails with errno == EBADF when fd is opened with O_PATH.
+ Reported by Jim Meyering in
+ <http://lists.gnu.org/archive/html/bug-gnulib/2012-11/msg00026.html>.
+ * doc/posix-headers/fcntl.texi (fcntl.h): Document this.
+ * lib/fcntl.in.h (O_EXEC, O_SEARCH) [O_PATH]: Default back to O_RDONLY.
+
2012-11-07 Paul Eggert <eggert@cs.ucla.edu>
test-utimens: speed up by taking shorter naps
@item
@samp{O_EXEC} and @samp{O_SEARCH} are not defined on some platforms.
-On platforms such as GNU/Linux 2.6.39 and later that have @samp{O_PATH},
-Gnulib defines these macros to @samp{O_PATH}.
-On other platforms, it defines them to @samp{O_RDONLY}, which is typically 0.
+Gnulib defines these macros to @samp{O_RDONLY}, which is typically 0.
+The @samp{O_PATH} macro of GNU/Linux is not a suitable substitute, as
+fchmod fails with @samp{errno==EBADF} when invoked on a file
+descriptor that was opened with @samp{O_PATH}.
@item
@samp{O_ACCMODE} is not defined on some platforms:
#endif
#ifndef O_EXEC
-# ifdef O_PATH
-# define O_EXEC O_PATH
-# else
-# define O_EXEC O_RDONLY /* This is often close enough in older systems. */
-# endif
+# define O_EXEC O_RDONLY /* This is often close enough in older systems. */
#endif
#ifndef O_IGNORE_CTTY
#endif
#ifndef O_SEARCH
-# ifdef O_PATH
-# define O_SEARCH O_PATH
-# else
-# define O_SEARCH O_RDONLY /* This is often close enough in older systems. */
-# endif
+# define O_SEARCH O_RDONLY /* This is often close enough in older systems. */
#endif
#ifndef O_SYNC