Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-09-05 22:20:12 +0400
committerRussell Belfer <rb@github.com>2013-09-05 22:20:12 +0400
commitf240acce865ec14df0d517d5000316a933e7ffed (patch)
tree33bb2efbb07ac32178ce242899ecaa8c6842c308 /src/checkout.c
parent27061b151a7e0225186365ee0b5ca802d68782a9 (diff)
Add more file mode permissions macros
This adds some more macros for some standard operations on file modes, particularly related to permissions, and then updates a number of places around the code base to use the new macros.
Diffstat (limited to 'src/checkout.c')
-rw-r--r--src/checkout.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/checkout.c b/src/checkout.c
index ec9da7e2e..f3a9b343d 100644
--- a/src/checkout.c
+++ b/src/checkout.c
@@ -693,17 +693,14 @@ static int buffer_to_file(
buffer, path, file_open_flags, file_mode)) < 0)
return error;
- if (st != NULL && (error = p_stat(path, st)) < 0) {
- giterr_set(GITERR_OS, "Error while statting '%s'", path);
- return error;
- }
+ if (st != NULL && (error = p_stat(path, st)) < 0)
+ giterr_set(GITERR_OS, "Error statting '%s'", path);
- if ((file_mode & 0100) != 0 && (error = p_chmod(path, file_mode)) < 0) {
+ else if (GIT_PERMS_EXECUTABLE(file_mode) &&
+ (error = p_chmod(path, file_mode)) < 0)
giterr_set(GITERR_OS, "Failed to set permissions on '%s'", path);
- return error;
- }
- return 0;
+ return error;
}
static int blob_content_to_file(