Mercurial > hg > octave-nkf > gnulib-hg
changeset 17152:22b1a8f00587
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.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Thu, 08 Nov 2012 01:23:20 -0800 |
parents | d20cbb4d40be |
children | dd4bcf7b9f4f |
files | ChangeLog doc/posix-headers/fcntl.texi lib/fcntl.in.h |
diffstat | 3 files changed, 16 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +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
--- a/doc/posix-headers/fcntl.texi +++ b/doc/posix-headers/fcntl.texi @@ -28,9 +28,10 @@ @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:
--- a/lib/fcntl.in.h +++ b/lib/fcntl.in.h @@ -213,11 +213,7 @@ #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 @@ -274,11 +270,7 @@ #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