Git development
 help / color / mirror / Atom feed
* [PATCH] Fix make_absolute_path() for parameters without a slash
@ 2008-03-02  7:17 Johannes Schindelin
  2008-03-02  7:31 ` Johannes Schindelin
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Schindelin @ 2008-03-02  7:17 UTC (permalink / raw)
  To: git, gitster


When passing "xyz" to make_absolute_path(), make_absolute_path()
erroneously tried to chdir("xyz"), and then append "/xyz".  Instead,
skip the chdir() completely when no slash was found.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---

	I should add a test, but I am simply too tired now.  Will do so 
	tomorrow.

 path.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/path.c b/path.c
index 4260952..bf3e469 100644
--- a/path.c
+++ b/path.c
@@ -311,8 +311,10 @@ const char *make_absolute_path(const char *path)
 			if (last_slash) {
 				*last_slash = '\0';
 				last_elem = xstrdup(last_slash + 1);
-			} else
+			} else {
+				*buf = '\0';
 				last_elem = xstrdup(buf);
+			}
 		}
 
 		if (*buf) {
-- 
1.5.4.3.446.gbe8932


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

end of thread, other threads:[~2008-03-02  7:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-02  7:17 [PATCH] Fix make_absolute_path() for parameters without a slash Johannes Schindelin
2008-03-02  7:31 ` Johannes Schindelin
2008-03-02  7:40   ` Johannes Schindelin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox