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. --- mtab.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mtab.c') diff --git a/mtab.c b/mtab.c index 91a40aa..cb6a59a 100644 --- a/mtab.c +++ b/mtab.c @@ -162,7 +162,7 @@ struct bfs_mtab *bfs_mtab_parse() { #elif BFS_MNTTAB - FILE *file = fopen(MNTTAB, "r"); + FILE *file = xfopen(MNTTAB, O_RDONLY | O_CLOEXEC); if (!file) { error = errno; goto fail; -- cgit v1.2.3