[PATCH 2/3] truncate cwd string before printing error message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Without this truncation the error message printed only shows the cwd
from the start of the search, not where it failed.

Signed-off-by: Lars R. Damerow <lars@xxxxxxxxx>
---
 setup.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/setup.c b/setup.c
index 5716d90..f0b56b9 100644
--- a/setup.c
+++ b/setup.c
@@ -422,8 +422,10 @@ const char *setup_git_directory_gently(int *nongit_ok)
 			}
 			die("Not a git repository (or any of the parent directories): %s", DEFAULT_GIT_DIR_ENVIRONMENT);
 		}
-		if (chdir(".."))
+		if (chdir("..")) {
+			cwd[offset] = '\0';
 			die_errno("Cannot change to '%s/..'", cwd);
+		}
 	}
 
 	inside_git_dir = 0;
-- 
1.6.5.2

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]