Merge branch 'rs/archive-zip-utf8'
[git.git] / abspath.c
index 3e8325c7368e1cb2e7f38d7a90aafdf4b9edde0c..05f2d7934878a832f5a2efdf4222c16223050853 100644 (file)
--- a/abspath.c
+++ b/abspath.c
@@ -45,8 +45,8 @@ const char *real_path(const char *path)
                if (!is_directory(buf)) {
                        char *last_slash = find_last_dir_sep(buf);
                        if (last_slash) {
-                               *last_slash = '\0';
                                last_elem = xstrdup(last_slash + 1);
+                               last_slash[1] = '\0';
                        } else {
                                last_elem = xstrdup(buf);
                                *buf = '\0';