diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2017-02-18 12:24:24 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2017-02-18 12:24:24 +0000 |
commit | ae42c38fbb91db68f7790476f2abeafb2b8a44f7 (patch) | |
tree | 7af7dbd83fcde5149a24dda0b9ae3226f08ac7a3 | |
parent | a007ea38462fb41a1489e9cb5090c8970db582ab (diff) | |
download | mandoc-ae42c38fbb91db68f7790476f2abeafb2b8a44f7.tar.gz |
proper test for O_DIRECTORY
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | catman.c | 4 | ||||
-rw-r--r-- | compat_fts.c | 6 | ||||
-rwxr-xr-x | configure | 3 | ||||
-rw-r--r-- | configure.local.example | 1 | ||||
-rw-r--r-- | test-O_DIRECTORY.c | 7 |
6 files changed, 12 insertions, 10 deletions
@@ -31,6 +31,7 @@ TESTSRCS = test-be32toh.c \ test-mkdtemp.c \ test-nanosleep.c \ test-ntohl.c \ + test-O_DIRECTORY.c \ test-ohash.c \ test-PATH_MAX.c \ test-pledge.c \ @@ -41,10 +41,6 @@ #include <time.h> #include <unistd.h> -#ifndef O_DIRECTORY -#define O_DIRECTORY 0 -#endif - int process_manpage(int, int, const char *); int process_tree(int, int); void run_mandocd(int, const char *, const char *) diff --git a/compat_fts.c b/compat_fts.c index 7e78e829..87847927 100644 --- a/compat_fts.c +++ b/compat_fts.c @@ -63,15 +63,9 @@ static FTSENT *fts_sort(FTS *, FTSENT *, int); static unsigned short fts_stat(FTS *, FTSENT *); #define ISDOT(a) (a[0] == '.' && (!a[1] || (a[1] == '.' && !a[2]))) -#ifndef O_DIRECTORY -#define O_DIRECTORY 0 -#endif #ifndef O_CLOEXEC #define O_CLOEXEC 0 #endif -#ifndef PATH_MAX -#define PATH_MAX 4096 -#endif #define CLR(opt) (sp->fts_options &= ~(opt)) #define ISSET(opt) (sp->fts_options & (opt)) @@ -67,6 +67,7 @@ HAVE_ISBLANK= HAVE_MKDTEMP= HAVE_NANOSLEEP= HAVE_NTOHL= +HAVE_O_DIRECTORY= HAVE_OHASH= HAVE_PATH_MAX= HAVE_PLEDGE= @@ -221,6 +222,7 @@ runtest getsubopt GETSUBOPT || true runtest isblank ISBLANK || true runtest mkdtemp MKDTEMP || true runtest ntohl NTOHL || true +runtest O_DIRECTORY O_DIRECTORY || true runtest PATH_MAX PATH_MAX || true runtest pledge PLEDGE || true runtest sandbox_init SANDBOX_INIT || true @@ -358,6 +360,7 @@ echo "#define MANPATH_DEFAULT \"${MANPATH_DEFAULT}\"" [ -n "${UTF8_LOCALE}" ] && echo "#define UTF8_LOCALE \"${UTF8_LOCALE}\"" [ -n "${HOMEBREWDIR}" ] && echo "#define HOMEBREWDIR \"${HOMEBREWDIR}\"" [ ${HAVE_EFTYPE} -eq 0 ] && echo "#define EFTYPE EINVAL" +[ ${HAVE_O_DIRECTORY} -eq 0 ] && echo "#define O_DIRECTORY 0" [ ${HAVE_PATH_MAX} -eq 0 ] && echo "#define PATH_MAX 4096" if [ ${HAVE_ENDIAN} -eq 0 -a ${HAVE_SYS_ENDIAN} -eq 0 ]; then echo "#define be32toh ntohl" diff --git a/configure.local.example b/configure.local.example index 8d1958d4..33a7bdec 100644 --- a/configure.local.example +++ b/configure.local.example @@ -279,6 +279,7 @@ HAVE_GETSUBOPT=0 HAVE_ISBLANK=0 HAVE_MKDTEMP=0 HAVE_NTOHL=0 +HAVE_O_DIRECTORY=0 HAVE_OHASH=0 HAVE_PATH_MAX=0 HAVE_PLEDGE=0 diff --git a/test-O_DIRECTORY.c b/test-O_DIRECTORY.c new file mode 100644 index 00000000..e44d51ca --- /dev/null +++ b/test-O_DIRECTORY.c @@ -0,0 +1,7 @@ +#include <fcntl.h> + +int +main(void) +{ + return open(".", O_RDONLY | O_DIRECTORY) == -1; +} |