1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-10-02 17:01:19 +02:00

12821: bin_dot is now independent of PATH_MAX

This commit is contained in:
Clint Adams 2000-09-17 16:24:05 +00:00
parent bd7969bfa5
commit 2abf9db381
2 changed files with 12 additions and 9 deletions

@ -1,3 +1,7 @@
2000-09-17 Clint Adams <schizo@debian.org>
* 12821: Src/builtin.c: bin_dot is now independent of PATH_MAX.
2000-09-16 Bart Schaefer <schaefer@zsh.org>
* 12817: Doc/Zsh/builtins.yo, Src/builtin.c: Give meaning to

@ -3259,11 +3259,10 @@ bin_dot(char *name, char **argv, char *ops, int func)
{
char **old, *old0 = NULL;
int ret, diddot = 0, dotdot = 0;
char buf[PATH_MAX];
char *s, **t, *enam, *arg0;
char *s, **t, *enam, *arg0, *buf;
struct stat st;
if (!*argv || strlen(*argv) >= PATH_MAX)
if (!*argv)
return 0;
old = pparams;
/* get arguments for the script */
@ -3304,18 +3303,18 @@ bin_dot(char *name, char **argv, char *ops, int func)
if (diddot)
continue;
diddot = 1;
strcpy(buf, arg0);
} else {
if (strlen(*t) + strlen(arg0) + 1 >= PATH_MAX)
continue;
sprintf(buf, "%s/%s", *t, arg0);
}
buf = ztrdup(arg0);
} else
buf = tricat(*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);
}
}
}