From: Ben Gras Date: Mon, 10 Oct 2005 09:02:16 +0000 (+0000) Subject: Make "mkdir -p a/./b" work (with ".") X-Git-Tag: v3.1.2a~652 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zpipe.c?a=commitdiff_plain;h=b7a0c0f8587cd2e37627a08424de32e04b85d188;p=minix.git Make "mkdir -p a/./b" work (with ".") --- diff --git a/commands/simple/mkdir.c b/commands/simple/mkdir.c index 9044966a1..9f837b528 100755 --- a/commands/simple/mkdir.c +++ b/commands/simple/mkdir.c @@ -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);