summaryrefslogtreecommitdiff
path: root/src/fileops.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-06-22 20:58:32 -0700
committerRussell Belfer <rb@github.com>2013-06-22 20:58:32 -0700
commit3d3ea4dc564922a3662298a7cfc2fc8b24149901 (patch)
treefdfc6507cad967fa809d0596f9ef097c0a74c22f /src/fileops.c
parent9f1b2c5cb79526f274c0c72eed56f9da0efb0321 (diff)
downloadlibgit2-3d3ea4dc564922a3662298a7cfc2fc8b24149901.tar.gz
Add O_CLOEXEC to open calls
Diffstat (limited to 'src/fileops.c')
-rw-r--r--src/fileops.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/fileops.c b/src/fileops.c
index ae240fcd2..1f58fa5cd 100644
--- a/src/fileops.c
+++ b/src/fileops.c
@@ -61,9 +61,11 @@ int git_futils_creat_locked(const char *path, const mode_t mode)
wchar_t buf[GIT_WIN_PATH];
git__utf8_to_16(buf, GIT_WIN_PATH, path);
- fd = _wopen(buf, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY | O_EXCL, mode);
+ fd = _wopen(buf, O_WRONLY | O_CREAT | O_TRUNC |
+ O_EXCL | O_BINARY | O_CLOEXEC, mode);
#else
- fd = open(path, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY | O_EXCL, mode);
+ fd = open(path, O_WRONLY | O_CREAT | O_TRUNC |
+ O_EXCL | O_BINARY | O_CLOEXEC, mode);
#endif
if (fd < 0) {