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. --- parse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'parse.c') diff --git a/parse.c b/parse.c index ad8e89c..98e7dbb 100644 --- a/parse.c +++ b/parse.c @@ -1278,7 +1278,7 @@ static struct expr *parse_files0_from(struct parser_state *state, int arg1, int if (strcmp(from, "-") == 0) { file = stdin; } else { - file = fopen(from, "rb"); + file = xfopen(from, O_RDONLY | O_CLOEXEC); } if (!file) { parse_error(state, "${blu}%s${rs} ${bld}%s${rs}: %m.\n", arg, from); -- cgit v1.2.3