X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=sha1_file.c;h=a08a9d08808bdb2f4a138d7e6f602b61fc093c1b;hb=a347b17f15dd5358ced8d447af144a46b224982d;hp=006321e009b321db6cf4f7bf35d8385017a7076a;hpb=6d84bcb5de78251d98f7d3e80e822d9a4b8f4df3;p=git.git diff --git a/sha1_file.c b/sha1_file.c index 006321e00..a08a9d088 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -35,13 +35,6 @@ static size_t sz_fmt(size_t s) { return s; } const unsigned char null_sha1[20]; -static inline int offset_1st_component(const char *path) -{ - if (has_dos_drive_prefix(path)) - return 2 + (path[2] == '/'); - return *path == '/'; -} - int safe_create_leading_directories(char *path) { char *pos = path + offset_1st_component(path); @@ -2206,7 +2199,7 @@ int move_temp_to_file(const char *tmpfile, const char *filename) } out: - if (set_shared_perm(filename, (S_IFREG|0444))) + if (adjust_shared_perm(filename)) return error("unable to set permission to '%s'", filename); return 0; } @@ -2262,7 +2255,7 @@ static int create_tmpfile(char *buffer, size_t bufsiz, const char *filename) } memcpy(buffer, filename, dirlen); strcpy(buffer + dirlen, "tmp_obj_XXXXXX"); - fd = mkstemp(buffer); + fd = git_mkstemp_mode(buffer, 0444); if (fd < 0 && dirlen && errno == ENOENT) { /* Make sure the directory exists */ memcpy(buffer, filename, dirlen); @@ -2272,7 +2265,7 @@ static int create_tmpfile(char *buffer, size_t bufsiz, const char *filename) /* Try again */ strcpy(buffer + dirlen - 1, "/tmp_obj_XXXXXX"); - fd = mkstemp(buffer); + fd = git_mkstemp_mode(buffer, 0444); } return fd; }