From 2e918d33be152c1a57ffb3ff53e344cafb161a8c Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Tue, 21 Sep 2021 18:47:28 -0400 Subject: util: New xfopen() utility And use it to pass O_CLOEXEC to all FILE*'s, so the files opened for -fprint etc. don't get passed to the programs run by -exec etc. --- util.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'util.h') diff --git a/util.h b/util.h index be38db5..ccac549 100644 --- a/util.h +++ b/util.h @@ -288,4 +288,14 @@ char *xconfstr(int name); */ char *xgetdelim(FILE *file, char delim); +/** + * fopen() variant that takes open() style flags. + * + * @param path + * The path to open. + * @param flags + * Flags to pass to open(). + */ +FILE *xfopen(const char *path, int flags); + #endif // BFS_UTIL_H -- cgit v1.2.3