diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2008-09-25 08:50:01 -0700 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2008-09-25 08:50:01 -0700 |
commit | 58245a5e40e1f95976a4f0fd53c2e8d3a1c3c763 (patch) | |
tree | 5205c38d2787ac2353525c67aa2780b5b319724b /sha1_file.c | |
parent | ec3e97b84e739946413194c563a12779efda2155 (diff) | |
parent | 5f0bdf50c2eb640b4321acb9b34b3cb401f5ddfb (diff) | |
download | git-58245a5e40e1f95976a4f0fd53c2e8d3a1c3c763.tar.gz |
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.c | 6 |
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)) { |