Respin features.h usage so that we correctly test for features before we use them. Some BSD libc implementations may have one or the other flag, but not both.

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
This commit is contained in:
Robin H. Johnson 2012-01-23 05:26:40 +00:00
parent 319f5003c6
commit e3d0fe06bd
2 changed files with 6 additions and 4 deletions

View File

@ -4,5 +4,5 @@
SFX= .Linux.in SFX= .Linux.in
PKG_PREFIX?= /usr PKG_PREFIX?= /usr
CPPFLAGS+= -D_BSD_SOURCE -D_XOPEN_SOURCE=600 CPPFLAGS+= -D_BSD_SOURCE -D_XOPEN_SOURCE=700
LIBDL= -Wl,-Bdynamic -ldl LIBDL= -Wl,-Bdynamic -ldl

View File

@ -32,7 +32,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <features.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <getopt.h> #include <getopt.h>
@ -68,8 +67,11 @@ do_check(char *path, uid_t uid, gid_t gid, mode_t mode, inode_t type, bool trunc
if (!mode) /* 664 */ if (!mode) /* 664 */
mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH; mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH;
flags = O_CREAT|O_NDELAY|O_WRONLY|O_NOCTTY; flags = O_CREAT|O_NDELAY|O_WRONLY|O_NOCTTY;
#ifdef __USE_XOPEN2K8 #ifdef O_CLOEXEC
flags |= O_CLOEXEC|O_NOFOLLOW; flags |= O_CLOEXEC;
#endif
#ifdef O_NOFOLLOW
flags |= O_NOFOLLOW;
#endif #endif
if (trunc) if (trunc)
flags |= O_TRUNC; flags |= O_TRUNC;