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

github.com/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/path.c
diff options
context:
space:
mode:
authorDavid Turner <dturner@twopensource.com>2015-11-10 14:42:38 +0300
committerJeff King <peff@peff.net>2015-11-20 12:52:01 +0300
commiteb33876c262bec79a127b82a3a853ad00665d894 (patch)
treefe8f353bfc0a177d4df5c345cf005625778c97ee /path.c
parent7bd9bcf372d4c03bb7034346d72ae1318e2d0742 (diff)
initdb: make safe_create_dir public
Soon we will want to create initdb functions for ref backends, and code from initdb that calls this function needs to move into the files backend. So this function needs to be public. Signed-off-by: David Turner <dturner@twopensource.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Jeff King <peff@peff.net>
Diffstat (limited to 'path.c')
-rw-r--r--path.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/path.c b/path.c
index c740c4ff940..9d1ab1f69e2 100644
--- a/path.c
+++ b/path.c
@@ -740,6 +740,18 @@ int adjust_shared_perm(const char *path)
return 0;
}
+void safe_create_dir(const char *dir, int share)
+{
+ if (mkdir(dir, 0777) < 0) {
+ if (errno != EEXIST) {
+ perror(dir);
+ exit(1);
+ }
+ }
+ else if (share && adjust_shared_perm(dir))
+ die(_("Could not make %s writable by group"), dir);
+}
+
static int have_same_root(const char *path1, const char *path2)
{
int is_abs1, is_abs2;