git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/3] init-db.c: normalize env var handling.
@ 2005-04-20  4:28 Zach Welch
  2005-04-20  4:45 ` Linus Torvalds
  0 siblings, 1 reply; 4+ messages in thread
From: Zach Welch @ 2005-04-20  4:28 UTC (permalink / raw)
  To: git; +Cc: torvalds

This patch applies on top of:
        [PATCH 1/3] init-db.c: cleanup comments

 init-db.c |   11 +++--------
 1 files changed, 3 insertions(+), 8 deletions(-)

Signed-Off-By: Zach Welch <zw@superlucidity.net>

Normalize init-db environment variable handling, allowing the creation
of object directories with something other than DEFAULT_DB_ENVIRONMENT.

--- 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) {

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-04-20  4:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-20  4:28 [PATCH 2/3] init-db.c: normalize env var handling Zach Welch
2005-04-20  4:45 ` Linus Torvalds
2005-04-20  4:55   ` Zach Welch
2005-04-20  4:59     ` Linus Torvalds

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).