Merge branch 'jc/safe-c-l-d'

* jc/safe-c-l-d:
  safe_create_leading_directories(): make it about "leading" directories
This commit is contained in:
Shawn O. Pearce 2008-09-25 08:50:01 -07:00
commit 58245a5e40

View File

@ -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)) {