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>
This commit is contained in:
12
path.c
12
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;
|
||||
|
||||
Reference in New Issue
Block a user