summaryrefslogtreecommitdiff
path: root/src/fileops.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@github.com>2016-12-27 23:07:07 +0000
committerEdward Thomson <ethomson@github.com>2017-02-28 13:28:36 +0000
commit5a747e0c6c5170d29969eb15822c36d76dd3e4ac (patch)
treeb86860487e9dd2da2ee0e602bb1d896b88379219 /src/fileops.c
parenteb56ed81afd0091a0616a1099d7792f12e0726f6 (diff)
downloadlibgit2-5a747e0c6c5170d29969eb15822c36d76dd3e4ac.tar.gz
git_futils_writebuffer: default only when flags==0
Only use defaults for `git_futils_writebuffer` when flags == 0, lest (1 << 31) be treated as the defaults.
Diffstat (limited to 'src/fileops.c')
-rw-r--r--src/fileops.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/fileops.c b/src/fileops.c
index ffa692eed..13b1fc2a1 100644
--- a/src/fileops.c
+++ b/src/fileops.c
@@ -237,14 +237,14 @@ int git_futils_writebuffer(
{
int fd, do_fsync = 0, error = 0;
+ if (!flags)
+ flags = O_CREAT | O_TRUNC | O_WRONLY;
+
if ((flags & O_FSYNC) != 0)
do_fsync = 1;
flags &= ~O_FSYNC;
- if (flags <= 0)
- flags = O_CREAT | O_TRUNC | O_WRONLY;
-
if (!mode)
mode = GIT_FILEMODE_BLOB;