diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2013-11-05 01:46:32 +0400 |
---|---|---|
committer | Edward Thomson <ethomson@microsoft.com> | 2013-11-05 07:32:50 +0400 |
commit | f966acd13366d21e0b9beeecf021c0114596c716 (patch) | |
tree | 3564477bae4877f3accd9eb0963df9769369b3fe /src/filebuf.c | |
parent | 0e1115d2872fcb8f13fd28a52f1f14d52792623e (diff) |
Take umask into account in filebuf_commit
Diffstat (limited to 'src/filebuf.c')
-rw-r--r-- | src/filebuf.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/filebuf.c b/src/filebuf.c index 714a32395..de2944bbc 100644 --- a/src/filebuf.c +++ b/src/filebuf.c @@ -320,9 +320,13 @@ int git_filebuf_commit_at(git_filebuf *file, const char *path, mode_t mode) int git_filebuf_commit(git_filebuf *file, mode_t mode) { + mode_t mask; + /* temporary files cannot be committed */ assert(file && file->path_original); + p_umask(mask = p_umask(0)); + file->flush_mode = Z_FINISH; flush_buffer(file); @@ -338,7 +342,7 @@ int git_filebuf_commit(git_filebuf *file, mode_t mode) file->fd = -1; - if (p_chmod(file->path_lock, mode)) { + if (p_chmod(file->path_lock, (mode & ~mask))) { giterr_set(GITERR_OS, "Failed to set attributes for file at '%s'", file->path_lock); goto on_error; } |