diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/filebuf.c | 6 | ||||
-rw-r--r-- | src/odb_loose.c | 4 |
2 files changed, 7 insertions, 3 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; } diff --git a/src/odb_loose.c b/src/odb_loose.c index 0dfd78aee..3e52edf05 100644 --- a/src/odb_loose.c +++ b/src/odb_loose.c @@ -902,8 +902,8 @@ int git_odb_backend_loose( const char *objects_dir, int compression_level, int do_fsync, - mode_t dir_mode, - mode_t file_mode) + unsigned int dir_mode, + unsigned int file_mode) { loose_backend *backend; size_t objects_dirlen; |