diff options
Diffstat (limited to 'Src')
-rw-r--r-- | Src/builtin.c | 8 | ||||
-rw-r--r-- | Src/utils.c | 14 |
2 files changed, 18 insertions, 4 deletions
diff --git a/Src/builtin.c b/Src/builtin.c index 7fae149b0..6fa8da6e3 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -3297,25 +3297,25 @@ bin_dot(char *name, char **argv, char *ops, int func) break; } if (!*s || (ret && isset(PATHDIRS) && diddot < 2 && dotdot == 0)) { + pushheap(); /* search path for script */ for (t = path; *t; t++) { if (!(*t)[0] || ((*t)[0] == '.' && !(*t)[1])) { if (diddot) continue; diddot = 1; - buf = ztrdup(arg0); + buf = dupstring(arg0); } else - buf = tricat(*t, "/", arg0); + buf = zhtricat(*t, "/", arg0); s = unmeta(buf); if (access(s, F_OK) == 0 && stat(s, &st) >= 0 && !S_ISDIR(st.st_mode)) { ret = source(enam = buf); - zsfree(buf); break; } - zsfree(buf); } + popheap(); } } /* clean up and return */ diff --git a/Src/utils.c b/Src/utils.c index ab5fbbeb4..e503b6844 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -3473,6 +3473,20 @@ appstr(char *base, char const *append) } /**/ +mod_export char * +zhtricat(char const *s1, char const *s2, char const *s3) +{ + char *ptr; + + ptr = (char *)zhalloc(strlen(s1) + strlen(s2) + strlen(s3) + 1); + strcpy(ptr, s1); + strcat(ptr, s2); + strcat(ptr, s3); + return ptr; +} + + +/**/ static int upchdir(int n) { |