Make mkdir -p "a/./b" work (with ".")
This commit is contained in:
parent
bd5afd235a
commit
1f497fe707
@ -195,9 +195,11 @@ char *fordir;
|
||||
char parent[PATH_MAX + 1], *end;
|
||||
|
||||
strcpy(parent, fordir);
|
||||
if (!(end = strrchr(parent, '/'))) return(0);
|
||||
*end = '\0';
|
||||
if (!parent[0]) return(0);
|
||||
do {
|
||||
if (!(end = strrchr(parent, '/'))) return(0);
|
||||
*end = '\0';
|
||||
if (!parent[0] || !strcmp(parent, ".")) return(0);
|
||||
} while((last = strrchr(parent, '/')) && !strcmp(last+1, "."));
|
||||
|
||||
if (!stat(parent, &st)) {
|
||||
if (S_ISDIR(st.st_mode)) return(0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user