summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2019-01-26 17:16:04 +0000
committerColin Watson <cjwatson@debian.org>2019-01-26 17:16:04 +0000
commite3059f35410481ce018c70176aa1b40ddd5fc1dd (patch)
tree81d7a4c04adc9f4f9b640a29ba72750952d6b3d9
parent1e158043f516f2f7c79c730b2ea41574a65acda1 (diff)
Simplify includes using Gnulib's fcntl module
* bootstrap.conf (gnulib_modules): Add fcntl. * configure.ac (AC_CHECK_HEADERS): Remove check for fcntl.h. * libdb/db_btree.c, libdb/db_ndbm.c, libdb/mydbm.h, src/man.c: Include <fcntl.h> unconditionally. * src/man.c: Remove conditional definitions of R_OK and X_OK; Gnulib's <unistd.h> handles these.
-rw-r--r--bootstrap.conf1
-rw-r--r--configure.ac2
-rw-r--r--libdb/db_btree.c8
-rw-r--r--libdb/db_ndbm.c8
-rw-r--r--libdb/mydbm.h5
-rw-r--r--src/man.c12
6 files changed, 8 insertions, 28 deletions
diff --git a/bootstrap.conf b/bootstrap.conf
index 1b3054c2..83cd855e 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -26,6 +26,7 @@ gnulib_modules="
dirent
dirname
error
+ fcntl
flock
fnmatch-gnu
fstat
diff --git a/configure.ac b/configure.ac
index 9051687b..14ee3195 100644
--- a/configure.ac
+++ b/configure.ac
@@ -339,7 +339,7 @@ then
AC_MSG_ERROR([flex is required when building from revision control])
fi
gl_INIT
-AC_CHECK_HEADERS([fcntl.h sys/file.h linux/fiemap.h])
+AC_CHECK_HEADERS([sys/file.h linux/fiemap.h])
AC_CHECK_FUNCS([lchown posix_fadvise])
# Internationalization support.
diff --git a/libdb/db_btree.c b/libdb/db_btree.c
index 4469bf61..f1de4078 100644
--- a/libdb/db_btree.c
+++ b/libdb/db_btree.c
@@ -32,17 +32,13 @@
#include <stdio.h>
#include <errno.h>
#include <string.h>
+#include <fcntl.h>
+#include <unistd.h>
#include <sys/file.h> /* for flock() */
#include <sys/types.h> /* for open() */
#include <sys/stat.h>
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#include <unistd.h>
-
#include "stat-time.h"
#include "timespec.h"
diff --git a/libdb/db_ndbm.c b/libdb/db_ndbm.c
index af970322..992173ae 100644
--- a/libdb/db_ndbm.c
+++ b/libdb/db_ndbm.c
@@ -28,17 +28,13 @@
#include <stdlib.h>
#include <stdio.h>
+#include <fcntl.h>
+#include <unistd.h>
#include <sys/file.h> /* for flock() */
#include <sys/types.h> /* for open() */
#include <sys/stat.h>
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#include <unistd.h>
-
#include "stat-time.h"
#include "timespec.h"
#include "xvasprintf.h"
diff --git a/libdb/mydbm.h b/libdb/mydbm.h
index 567e96ad..32053e3e 100644
--- a/libdb/mydbm.h
+++ b/libdb/mydbm.h
@@ -90,12 +90,9 @@ void man_gdbm_close (man_gdbm_wrapper wrap);
# elif defined(NDBM) && !defined(GDBM) && !defined(BTREE)
+# include <fcntl.h>
# include <ndbm.h>
-# if HAVE_FCNTL_H
-# include <fcntl.h>
-# endif
-
/* Berkeley db routines emulate ndbm but don't add .dir & .pag, just .db! */
# ifdef _DB_H_ /* has Berkeley db.h been included? */
# define BERKELEY_DB
diff --git a/src/man.c b/src/man.c
index ac1f14cb..693f03d0 100644
--- a/src/man.c
+++ b/src/man.c
@@ -49,18 +49,8 @@
#include <errno.h>
#include <termios.h>
#include <unistd.h>
-
-#ifndef R_OK
-# define R_OK 4
-# define X_OK 1
-#endif /* !R_OK */
-
#include <limits.h>
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
+#include <fcntl.h>
#include <ctype.h>
#include <signal.h>
#include <time.h>