summary refs log tree commit diff
path: root/Src/Modules
diff options
context:
space:
mode:
authorBart Schaefer <barts@users.sourceforge.net>2000-08-05 05:59:53 +0000
committerBart Schaefer <barts@users.sourceforge.net>2000-08-05 05:59:53 +0000
commit1ff8518b16525776c932d8856d62b79343a53b72 (patch)
tree7c55c4dbe2e3c811b951051c1102a1a0ca49f139 /Src/Modules
parent45ffc3b6c8e5cca800a0ed55bbf9b1bb1c362b00 (diff)
downloadzsh-1ff8518b16525776c932d8856d62b79343a53b72.tar.gz
zsh-1ff8518b16525776c932d8856d62b79343a53b72.tar.xz
zsh-1ff8518b16525776c932d8856d62b79343a53b72.zip
12547: Handle ENOENT and ENOTDIR in zpathmax().
Diffstat (limited to 'Src/Modules')
-rw-r--r--Src/Modules/files.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/Src/Modules/files.c b/Src/Modules/files.c
index ac775c75a..d01a59b03 100644
--- a/Src/Modules/files.c
+++ b/Src/Modules/files.c
@@ -71,7 +71,6 @@ bin_mkdir(char *nam, char **args, char *ops, int func)
     mode_t oumask = umask(0);
     mode_t mode = 0777 & ~oumask;
     int err = 0;
-    char *head;
 
     umask(oumask);
     if(ops['m']) {
@@ -92,19 +91,8 @@ bin_mkdir(char *nam, char **args, char *ops, int func)
 
 	while(ptr > *args + (**args == '/') && *--ptr == '/')
 	    *ptr = 0;
-
-/* Drop the tail so that pathconf receives a potentially valid pathname */
-	head = (char *) ztrdup(*args);
-	if ((ptr = strrchr(head, '/')))
-	    *ptr = 0;
-	else {
-/* Relative to current directory */
-	    *head = '.';
-	    *(head + 1) = '\0';
-	}
-
-	if(zpathmax(unmeta(head)) < 0) {
-	    zwarnnam(nam, "%s: %e", head, errno);
+	if(zpathmax(unmeta(*args)) < 0) {
+	    zwarnnam(nam, "%s: %e", *args, errno);
 	    err = 1;
 	    continue;
 	}
@@ -133,8 +121,6 @@ bin_mkdir(char *nam, char **args, char *ops, int func)
 	    }
 	} else
 	    err |= domkdir(nam, *args, mode, 0);
-
-	free(head);
     }
     return err;
 }