summaryrefslogtreecommitdiff
path: root/files.c
diff options
context:
space:
mode:
authorRobert Swiecki <swiecki@google.com>2016-11-14 17:55:43 +0100
committerRobert Swiecki <swiecki@google.com>2016-11-14 17:55:51 +0100
commita95854a5d6b0cee65ee6aa4e9bc1e9afb6c3f736 (patch)
tree7fb969c4e32202af037dec58a1d279a4c050bd12 /files.c
parent20b0d0bb9627b335a88a74078efd389ace87f7c0 (diff)
downloadhonggfuzz-a95854a5d6b0cee65ee6aa4e9bc1e9afb6c3f736.tar.gz
Add O_CLOEXEC to file*
Diffstat (limited to 'files.c')
-rw-r--r--files.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/files.c b/files.c
index 23b1309e..e2a6e3df 100644
--- a/files.c
+++ b/files.c
@@ -42,7 +42,7 @@
ssize_t files_readFileToBufMax(char *fileName, uint8_t * buf, size_t fileMaxSz)
{
- int fd = open(fileName, O_RDONLY);
+ int fd = open(fileName, O_RDONLY | O_CLOEXEC);
if (fd == -1) {
PLOG_W("Couldn't open '%s' for R/O", fileName);
return -1;
@@ -322,10 +322,10 @@ bool files_copyFile(const char *source, const char *destination, bool * dstExist
mode_t dstFilePerms;
// O_EXCL is important for saving unique crashes
- dstOpenFlags = O_CREAT | O_WRONLY | O_EXCL;
+ dstOpenFlags = O_CREAT | O_WRONLY | O_EXCL | O_CLOEXEC;
dstFilePerms = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
- inFD = open(source, O_RDONLY);
+ inFD = open(source, O_RDONLY | O_CLOEXEC);
if (inFD == -1) {
PLOG_D("Couldn't open '%s' source", source);
return false;