about summary refs log tree commit diff
path: root/Src/builtin.c
diff options
context:
space:
mode:
authorClint Adams <clint@users.sourceforge.net>2001-02-14 23:36:23 +0000
committerClint Adams <clint@users.sourceforge.net>2001-02-14 23:36:23 +0000
commite846a825fedd5e042199d4caf67d1e7145528a0d (patch)
treefd6efd8454b1c84e746b750c28c3863c1e86f05f /Src/builtin.c
parent53a7b0c44575552a997c1f09a5f4ea13d80fe965 (diff)
downloadzsh-e846a825fedd5e042199d4caf67d1e7145528a0d.tar.gz
zsh-e846a825fedd5e042199d4caf67d1e7145528a0d.tar.xz
zsh-e846a825fedd5e042199d4caf67d1e7145528a0d.zip
13478: whence shouldn't segfault on an empty path component
Diffstat (limited to 'Src/builtin.c')
-rw-r--r--Src/builtin.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index 8a33a5312..e73a7a452 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -2468,14 +2468,14 @@ bin_whence(char *nam, char **argv, char *ops, int func)
 	/* Option -a is to search the entire path, *
 	 * rather than just looking for one match. */
 	if (all) {
-	    char **pp, *buf, *z;
+	    char **pp, *buf;
 
 	    pushheap();
 	    for (pp = path; *pp; pp++) {
 		if (**pp) {
-		    z = dyncat(*pp, "/");
-		} else z = NULL;
-		buf = dyncat(z, *argv);
+		    buf = zhtricat(*pp, "/", *argv);
+		} else buf = ztrdup(*argv);
+
 		if (iscom(buf)) {
 		    if (wd) {
 			printf("%s: command\n", *argv);