aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-02-18 12:24:24 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-02-18 12:24:24 +0000
commita09c2af4f8767c7cb3b4f490da5febe63d9fe552 (patch)
tree18f502a1bb05cea82c49f98cc99598480246e70b
parentd5f9d96f34d3bad7e78dad6e61178263dce65f34 (diff)
downloadmandoc-a09c2af4f8767c7cb3b4f490da5febe63d9fe552.tar.gz
mandoc-a09c2af4f8767c7cb3b4f490da5febe63d9fe552.tar.zst
mandoc-a09c2af4f8767c7cb3b4f490da5febe63d9fe552.zip
proper test for O_DIRECTORY
-rw-r--r--Makefile3
-rw-r--r--catman.c6
-rw-r--r--compat_fts.c8
-rwxr-xr-xconfigure5
-rw-r--r--configure.local.example3
-rw-r--r--test-O_DIRECTORY.c7
6 files changed, 17 insertions, 15 deletions
diff --git a/Makefile b/Makefile
index ab46286a..3c2dcb4b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.501 2017/02/16 16:09:33 schwarze Exp $
+# $Id: Makefile,v 1.502 2017/02/18 12:24:24 schwarze Exp $
#
# Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
# Copyright (c) 2011, 2013-2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -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 \
diff --git a/catman.c b/catman.c
index 5c5bd7f8..7d62c0e7 100644
--- a/catman.c
+++ b/catman.c
@@ -1,4 +1,4 @@
-/* $Id: catman.c,v 1.20 2017/02/17 14:31:52 schwarze Exp $ */
+/* $Id: catman.c,v 1.21 2017/02/18 12:24:24 schwarze Exp $ */
/*
* Copyright (c) 2017 Michael Stapelberg <stapelberg@debian.org>
* Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -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 f0a9d4c8..3859111a 100644
--- a/compat_fts.c
+++ b/compat_fts.c
@@ -6,7 +6,7 @@ int dummy;
#else
-/* $Id: compat_fts.c,v 1.13 2017/02/15 15:58:46 schwarze Exp $ */
+/* $Id: compat_fts.c,v 1.14 2017/02/18 12:24:24 schwarze Exp $ */
/* $OpenBSD: fts.c,v 1.56 2016/09/21 04:38:56 guenther Exp $ */
/*-
@@ -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))
diff --git a/configure b/configure
index 9c4ffc52..588cab12 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $Id: configure,v 1.60 2017/02/17 14:40:28 schwarze Exp $
+# $Id: configure,v 1.61 2017/02/18 12:24:24 schwarze Exp $
#
# Copyright (c) 2014, 2015, 2016, 2017 Ingo Schwarze <schwarze@openbsd.org>
#
@@ -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 280627f3..365c700c 100644
--- a/configure.local.example
+++ b/configure.local.example
@@ -1,4 +1,4 @@
-# $Id: configure.local.example,v 1.28 2017/02/16 16:09:33 schwarze Exp $
+# $Id: configure.local.example,v 1.29 2017/02/18 12:24:24 schwarze Exp $
#
# Copyright (c) 2014, 2015, 2016, 2017 Ingo Schwarze <schwarze@openbsd.org>
#
@@ -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;
+}