summaryrefslogtreecommitdiff
path: root/path.c
diff options
context:
space:
mode:
authorTorsten Bögershausen <tboegi@web.de>2013-03-30 10:53:32 +0100
committerJunio C Hamano <gitster@pobox.com>2013-04-05 12:37:55 -0700
commit3a429d3b8d03c98fbc775eb34a54b7b2bd74e02b (patch)
tree9938523b58ac4e5ed643066a4068e0979bc63f43 /path.c
parent0117c2f043183fb99e9b046b0df7d64c1b296624 (diff)
downloadgit-3a429d3b8d03c98fbc775eb34a54b7b2bd74e02b.tar.gz
path.c: simplify adjust_shared_perm()
All calls to set_shared_perm() use mode == 0, so simplify the function. Because all callers use the macro adjust_shared_perm(path) from cache.h to call this function, convert it to a proper function, losing set_shared_perm(). Since path.c has much more functions than just mkpath() these days, drop the stale comment about it. Signed-off-by: Torsten Bögershausen <tboegi@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'path.c')
-rw-r--r--path.c27
1 files changed, 7 insertions, 20 deletions
diff --git a/path.c b/path.c
index 2fdccc2f18..e27959a12b 100644
--- a/path.c
+++ b/path.c
@@ -1,14 +1,5 @@
/*
- * I'm tired of doing "vsnprintf()" etc just to open a
- * file, so here's a "return static buffer with printf"
- * interface for paths.
- *
- * It's obviously not thread-safe. Sue me. But it's quite
- * useful for doing things like
- *
- * f = open(mkpath("%s/%s.git", base, name), O_RDONLY);
- *
- * which is what it's designed for.
+ * Utilities for paths and pathnames
*/
#include "cache.h"
#include "strbuf.h"
@@ -405,21 +396,17 @@ const char *enter_repo(const char *path, int strict)
return NULL;
}
-int set_shared_perm(const char *path, int mode)
+int adjust_shared_perm(const char *path)
{
- int tweak, shared, orig_mode;
+ int tweak, shared, orig_mode, mode;
if (!shared_repository) {
- if (mode)
- return chmod(path, mode & ~S_IFMT);
return 0;
}
- if (!mode) {
- if (get_st_mode_bits(path, &mode) < 0)
- return -1;
- orig_mode = mode;
- } else
- orig_mode = 0;
+ if (get_st_mode_bits(path, &mode) < 0)
+ return -1;
+
+ orig_mode = mode;
if (shared_repository < 0)
shared = -shared_repository;
else