commit 48e6870bb7aeb00818ba98307f40e6726cd71c61
parent 7adf4f380a05dd88a61aadfa9c473473e012bbc1
Author: David Galos <galosd83@students.rowan.edu>
Date: Thu, 11 Jul 2013 21:43:38 -0400
Making `mkdir -p` handle empty paths. Thanks, Willem van de Krol!
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mkdir.c b/mkdir.c
@@ -46,7 +46,7 @@ mkdirp(char *path)
char *p = path;
do {
- if((p = strchr(&p[1], '/')))
+ if(*p && (p = strchr(&p[1], '/')))
*p = '\0';
if(mkdir(path, S_IRWXU|S_IRWXG|S_IRWXO) == -1 && errno != EEXIST)
eprintf("mkdir %s:", path);