git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix builtin checkout crashing when given an invalid path
@ 2008-02-28 16:30 Alex Riesen
  2008-02-28 16:49 ` [PATCH] Expect the exit code of builtin checkout to be in portable range Alex Riesen
  0 siblings, 1 reply; 3+ messages in thread
From: Alex Riesen @ 2008-02-28 16:30 UTC (permalink / raw)
  To: Daniel Barkalow; +Cc: Junio C Hamano, git

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
---

Noticed in t2008, which actually passed, but silently removed
core-files (I saw segfaults in syslog) and did not properly check the
exit code.  The change for the t2008 comes as seperate patch, but it
should be noted that "! command" is *not* how you check for a command
to have failed. It could have crashed.

 builtin-checkout.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/builtin-checkout.c b/builtin-checkout.c
index 4a4bb8b..9579ff4 100644
--- a/builtin-checkout.c
+++ b/builtin-checkout.c
@@ -545,6 +545,10 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
 
 	if (argc) {
 		const char **pathspec = get_pathspec(prefix, argv);
+
+		if (!pathspec)
+			die("invalid path specification");
+
 		/* Checkout paths */
 		if (opts.new_branch || opts.force || opts.merge) {
 			if (argc == 1) {
-- 
1.5.4.3.253.g9f1d5



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

end of thread, other threads:[~2008-02-28 20:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-28 16:30 [PATCH] Fix builtin checkout crashing when given an invalid path Alex Riesen
2008-02-28 16:49 ` [PATCH] Expect the exit code of builtin checkout to be in portable range Alex Riesen
2008-02-28 20:52   ` Junio C Hamano

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