git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zach Welch <zw@superlucidity.net>
To: git@vger.kernel.org
Cc: torvalds@osdl.org
Subject: [PATCH 2/3] init-db.c: normalize env var handling.
Date: Tue, 19 Apr 2005 21:28:39 -0700	[thread overview]
Message-ID: <mailbox-1242-1113971319-971926@spoon> (raw)
In-Reply-To: mailbox-1242-1113971319-958842@spoon

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

             reply	other threads:[~2005-04-20  4:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-20  4:28 Zach Welch [this message]
2005-04-20  4:45 ` [PATCH 2/3] init-db.c: normalize env var handling Linus Torvalds
2005-04-20  4:55   ` Zach Welch
2005-04-20  4:59     ` Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=mailbox-1242-1113971319-971926@spoon \
    --to=zw@superlucidity.net \
    --cc=git@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).