Making mkdir -p
handle empty paths. Thanks, Willem van de Krol!
This commit is contained in:
parent
7adf4f380a
commit
48e6870bb7
2
mkdir.c
2
mkdir.c
|
@ -46,7 +46,7 @@ mkdirp(char *path)
|
||||||
char *p = path;
|
char *p = path;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if((p = strchr(&p[1], '/')))
|
if(*p && (p = strchr(&p[1], '/')))
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
if(mkdir(path, S_IRWXU|S_IRWXG|S_IRWXO) == -1 && errno != EEXIST)
|
if(mkdir(path, S_IRWXU|S_IRWXG|S_IRWXO) == -1 && errno != EEXIST)
|
||||||
eprintf("mkdir %s:", path);
|
eprintf("mkdir %s:", path);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user