From 7875acb6ecf85a7dc29554d193955ce5e265764f Mon Sep 17 00:00:00 2001 From: Jeff King Date: Fri, 11 Mar 2016 17:36:49 -0500 Subject: wrap shared_repository global in get/set accessors It would be useful to control access to the global shared_repository, so that we can lazily load its config. The first step to doing so is to make sure all access goes through a set of functions. This step is purely mechanical, and should result in no change of behavior. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- path.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'path.c') diff --git a/path.c b/path.c index 8b7e168129..a6f1cd69a0 100644 --- a/path.c +++ b/path.c @@ -699,17 +699,17 @@ static int calc_shared_perm(int mode) { int tweak; - if (shared_repository < 0) - tweak = -shared_repository; + if (get_shared_repository() < 0) + tweak = -get_shared_repository(); else - tweak = shared_repository; + tweak = get_shared_repository(); if (!(mode & S_IWUSR)) tweak &= ~0222; if (mode & S_IXUSR) /* Copy read bits to execute bits */ tweak |= (tweak & 0444) >> 2; - if (shared_repository < 0) + if (get_shared_repository() < 0) mode = (mode & ~0777) | tweak; else mode |= tweak; @@ -722,7 +722,7 @@ int adjust_shared_perm(const char *path) { int old_mode, new_mode; - if (!shared_repository) + if (!get_shared_repository()) return 0; if (get_st_mode_bits(path, &old_mode) < 0) return -1; -- cgit v1.2.3