diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2010-09-10 11:55:27 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2010-09-10 11:55:27 -0700 |
commit | ffb0b29997c66526985e1f4a496335d0ab4ef111 (patch) | |
tree | 855831d96cb87ac718f45362cd6bdea26cfa2ae3 /lib/fcntl.in.h | |
parent | 3f322af6c93f7eb4c6ce5ceb789416aae10a50bd (diff) | |
download | gnulib-ffb0b29997c66526985e1f4a496335d0ab4ef111.tar.gz |
fcntl-h: define O_CLOEXEC and O_EXEC if not defined; use new defines
* doc/posix-headers/fcntl.texi (fcntl.h): Document that
O_CLOEXEC is now defined to 0 if it is not defined, like other flags.
Also, O_EXEC is now defined to be O_RDONLY if O_EXEC is not defined.
Similarly for O_SEARCH; this last was already true, but not documented.
* lib/fcntl.in.h (O_CLOEXEC): Define to 0 if not defined.
* lib/dup-safer-flag.c (O_CLOEXEC): Remove now-useless #define.
* lib/dup3.c, lib/pipe2.c, tests/test-dup-safer.c, tests/test-fcntl.c:
Likewise.
* lib/popen-safer.c (open_noinherit): Check whether O_CLOEXEC
is zero, not whether it is defined.
* tests/test-dup3.c, tests/test-pipe2.c (main): Likewise.
* lib/progreloc.c (find_executable): Use O_EXEC rather than O_RDONLY.
* lib/open.c (open): Check for O_SEARCH as well as for O_RDONLY.
Diffstat (limited to 'lib/fcntl.in.h')
-rw-r--r-- | lib/fcntl.in.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h index 42fb81bfb0..a7e4a95016 100644 --- a/lib/fcntl.in.h +++ b/lib/fcntl.in.h @@ -170,6 +170,10 @@ _GL_WARN_ON_USE (openat, "openat is not portable - " # define O_CLOEXEC O_NOINHERIT #endif +#ifndef O_CLOEXEC +# define O_CLOEXEC 0 +#endif + #ifndef O_DIRECT # define O_DIRECT 0 #endif @@ -182,6 +186,10 @@ _GL_WARN_ON_USE (openat, "openat is not portable - " # define O_DSYNC 0 #endif +#ifndef O_EXEC +# define O_EXEC O_RDONLY /* This is often close enough in older systems. */ +#endif + #ifndef O_NDELAY # define O_NDELAY 0 #endif |