From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: git@vger.kernel.org, gitster@pobox.com
Subject: [PATCH] git-show: only chdir(prefix) when prefix is not NULL, and check for success
Date: Sun, 2 Dec 2007 01:42:06 +0000 (GMT) [thread overview]
Message-ID: <Pine.LNX.4.64.0712020141530.27959@racer.site> (raw)
We blindly called "chdir(prefix);" and did not even check if it succeeded.
Found by valgrind.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
builtin-log.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/builtin-log.c b/builtin-log.c
index 21f3b0f..0f38579 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -285,7 +285,8 @@ int cmd_show(int argc, const char **argv, const char *prefix)
struct object_array_entry *objects;
int i, count, ret = 0;
- chdir(prefix);
+ if (prefix && chdir(prefix))
+ die ("Could not change directory to '%s'", prefix);
git_config(git_log_config);
init_revisions(&rev, prefix);
--
1.5.3.6.2112.ge2263
reply other threads:[~2007-12-02 1:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=Pine.LNX.4.64.0712020141530.27959@racer.site \
--to=johannes.schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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).