summaryrefslogtreecommitdiffstats
path: root/color.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2021-09-21 18:47:28 -0400
committerTavian Barnes <tavianator@tavianator.com>2021-09-21 18:47:28 -0400
commit2e918d33be152c1a57ffb3ff53e344cafb161a8c (patch)
tree1549a3e1be09d4e565bfa58de0c03191e3d4e718 /color.c
parent10cb15e914bcf9257f14e09302fb4ab5b0aaf348 (diff)
downloadbfs-2e918d33be152c1a57ffb3ff53e344cafb161a8c.tar.xz
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.
Diffstat (limited to 'color.c')
-rw-r--r--color.c2
1 files changed, 1 insertions, 1 deletions
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;