summaryrefslogtreecommitdiffstats
path: root/abspath.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-06-29 17:09:17 -0700
committerJunio C Hamano <gitster@pobox.com>2011-06-29 17:09:17 -0700
commit033c2dc4364042b9e6dbd44e82e1974f78a72567 (patch)
tree8a7dc969376cd254dd46e5f4038f9592929f8a7a /abspath.c
parent1fd7ef2e8f6b8b67f4d3be7b9ab5bbd9d8f639ec (diff)
parente0f530ff8afbd252170f57e70a8609a83a7cabe1 (diff)
downloadgit-033c2dc4364042b9e6dbd44e82e1974f78a72567.tar.gz
git-033c2dc4364042b9e6dbd44e82e1974f78a72567.tar.xz
Merge branch 'ef/maint-win-verify-path'
* ef/maint-win-verify-path: verify_dotfile(): do not assume '/' is the path seperator verify_path(): simplify check at the directory boundary verify_path: consider dos drive prefix real_path: do not assume '/' is the path seperator A Windows path starting with a backslash is absolute
Diffstat (limited to 'abspath.c')
-rw-r--r--abspath.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/abspath.c b/abspath.c
index 3005aedde..01858eb7b 100644
--- a/abspath.c
+++ b/abspath.c
@@ -40,7 +40,7 @@ const char *real_path(const char *path)
while (depth--) {
if (!is_directory(buf)) {
- char *last_slash = strrchr(buf, '/');
+ char *last_slash = find_last_dir_sep(buf);
if (last_slash) {
*last_slash = '\0';
last_elem = xstrdup(last_slash + 1);
@@ -65,7 +65,7 @@ const char *real_path(const char *path)
if (len + strlen(last_elem) + 2 > PATH_MAX)
die ("Too long path name: '%s/%s'",
buf, last_elem);
- if (len && buf[len-1] != '/')
+ if (len && !is_dir_sep(buf[len-1]))
buf[len++] = '/';
strcpy(buf + len, last_elem);
free(last_elem);