summaryrefslogtreecommitdiff
path: root/init-db.c
diff options
context:
space:
mode:
authorZach Welch <zw@superlucidity.net>2005-04-20 04:48:15 (GMT)
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-20 04:48:15 (GMT)
commitaddb315d341437b11477d617fda3fd80e7bce3c1 (patch)
tree42370b18ee4f3afa9ac52526bf2b2006213685ed /init-db.c
parent4696cb93d1e2ded452e4e673633fd6495698ffcd (diff)
downloadgit-addb315d341437b11477d617fda3fd80e7bce3c1.zip
git-addb315d341437b11477d617fda3fd80e7bce3c1.tar.gz
git-addb315d341437b11477d617fda3fd80e7bce3c1.tar.bz2
[PATCH] init-db.c: normalize env var handling.
Normalize init-db environment variable handling, allowing the creation of object directories with something other than DEFAULT_DB_ENVIRONMENT. Signed-Off-By: Zach Welch <zw@superlucidity.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'init-db.c')
-rw-r--r--init-db.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/init-db.c b/init-db.c
index bfbe1eb..7078cf7 100644
--- a/init-db.c
+++ b/init-db.c
@@ -22,15 +22,10 @@ int main(int argc, char **argv)
}
sha1_dir = getenv(DB_ENVIRONMENT);
- if (sha1_dir) {
- struct stat st;
- if (!stat(sha1_dir, &st) && S_ISDIR(st.st_mode))
- return 0;
- fprintf(stderr, "DB_ENVIRONMENT set to bad directory %s: ", sha1_dir);
+ if (!sha1_dir) {
+ sha1_dir = DEFAULT_DB_ENVIRONMENT;
+ fprintf(stderr, "defaulting to local storage area\n");
}
-
- sha1_dir = DEFAULT_DB_ENVIRONMENT;
- fprintf(stderr, "defaulting to private storage area\n");
len = strlen(sha1_dir);
if (mkdir(sha1_dir, 0755) < 0) {
if (errno != EEXIST) {