diff options
| author | Edward Thomson <ethomson@github.com> | 2016-12-27 23:07:07 +0000 |
|---|---|---|
| committer | Edward Thomson <ethomson@github.com> | 2017-02-28 13:28:36 +0000 |
| commit | 5a747e0c6c5170d29969eb15822c36d76dd3e4ac (patch) | |
| tree | b86860487e9dd2da2ee0e602bb1d896b88379219 /src/fileops.c | |
| parent | eb56ed81afd0091a0616a1099d7792f12e0726f6 (diff) | |
| download | libgit2-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.c | 6 |
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; |
