>From 160e2f8258cb2a3f8cf055658b1840df5347bd6a Mon Sep 17 00:00:00 2001 From: Bernhard Voelker Date: Wed, 2 Dec 2020 01:12:16 +0100 Subject: [PATCH 1/2] maint: use more *-safer gnulib modules See section "Handling closed standard file descriptors" in the gnulib manual. * bootstrip.conf (gnulib_modules): Add fcntl-safer, openat-safer and unistd-safer. * find/exec.c: Include "fcntl--.h" to use the *-safer variant of open() or openat(). * find/pred.c: Likewise. * locate/locate.c: Likewise. * xargs/xargs.c: Likewise, and include "unustd--.h" to use the *-safer variant of pipe(). --- bootstrap.conf | 3 +++ find/exec.c | 1 + find/pred.c | 1 + locate/locate.c | 1 + xargs/xargs.c | 2 ++ 5 files changed, 8 insertions(+) diff --git a/bootstrap.conf b/bootstrap.conf index 8e0dbcf1..a80e2897 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -93,6 +93,7 @@ gnulib_modules=" faccessat fchdir fcntl + fcntl-safer fdopendir fflush fileblocks @@ -131,6 +132,7 @@ gnulib_modules=" mountlist nstrftime open + openat-safer parse-datetime pathmax perror @@ -167,6 +169,7 @@ gnulib_modules=" sys_wait timespec uname + unistd-safer unlinkat verify version-etc diff --git a/find/exec.c b/find/exec.c index 5551de56..e8f14d10 100644 --- a/find/exec.c +++ b/find/exec.c @@ -30,6 +30,7 @@ #include "cloexec.h" #include "dirname.h" #include "error.h" +#include "fcntl--.h" #include "save-cwd.h" #include "xalloc.h" diff --git a/find/pred.c b/find/pred.c index 9f2f159e..7a64a866 100644 --- a/find/pred.c +++ b/find/pred.c @@ -38,6 +38,7 @@ #include "areadlink.h" #include "dirname.h" #include "error.h" +#include "fcntl--.h" #include "fnmatch.h" #include "stat-size.h" #include "stat-time.h" diff --git a/locate/locate.c b/locate/locate.c index b3a49b84..bcd76103 100644 --- a/locate/locate.c +++ b/locate/locate.c @@ -84,6 +84,7 @@ #include "progname.h" #include "xalloc.h" #include "error.h" +#include "fcntl--.h" #include "human.h" #include "dirname.h" #include "closeout.h" diff --git a/xargs/xargs.c b/xargs/xargs.c index e9ef763c..1149999c 100644 --- a/xargs/xargs.c +++ b/xargs/xargs.c @@ -54,9 +54,11 @@ /* gnulib headers. */ #include "closein.h" #include "error.h" +#include "fcntl--.h" #include "progname.h" #include "quotearg.h" #include "safe-read.h" +#include "unistd--.h" #include "xalloc.h" /* find headers. */ -- 2.29.2