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. --- color.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'color.c') diff --git a/color.c b/color.c index 509e646..09070f2 100644 --- a/color.c +++ b/color.c @@ -526,7 +526,7 @@ CFILE *cfopen(const char *path, const struct colors *colors) { return NULL; } - cfile->file = fopen(path, "wb"); + cfile->file = xfopen(path, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC); if (!cfile->file) { cfclose(cfile); return NULL; -- cgit v1.2.3