Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2008-09-25 19:50:01 +0400
committerShawn O. Pearce <spearce@spearce.org>2008-09-25 19:50:01 +0400
commit58245a5e40e1f95976a4f0fd53c2e8d3a1c3c763 (patch)
tree5205c38d2787ac2353525c67aa2780b5b319724b /sha1_file.c
parentec3e97b84e739946413194c563a12779efda2155 (diff)
parent5f0bdf50c2eb640b4321acb9b34b3cb401f5ddfb (diff)
Merge branch 'jc/safe-c-l-d'
* jc/safe-c-l-d: safe_create_leading_directories(): make it about "leading" directories
Diffstat (limited to 'sha1_file.c')
-rw-r--r--sha1_file.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sha1_file.c b/sha1_file.c
index aec81bbae7..7d4f24d564 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -99,7 +99,11 @@ int safe_create_leading_directories(char *path)
pos = strchr(pos, '/');
if (!pos)
break;
- *pos = 0;
+ while (*++pos == '/')
+ ;
+ if (!*pos)
+ break;
+ *--pos = '\0';
if (!stat(path, &st)) {
/* path exists */
if (!S_ISDIR(st.st_mode)) {