summaryrefslogtreecommitdiff
path: root/Src/builtin.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2009-07-01 15:07:25 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2009-07-01 15:07:25 +0000
commit041057687fc1d4a2f9912fcb86e04517686b3642 (patch)
tree0f0d181cebf9c50bf3e2d9d4a50643eafde9a140 /Src/builtin.c
parent88d07936a21c262ec5f86518cce3c85fd1951968 (diff)
downloadzsh-041057687fc1d4a2f9912fcb86e04517686b3642.tar.gz
zsh-041057687fc1d4a2f9912fcb86e04517686b3642.zip
27083: non-zero status on failures to find or execute file in "."
Diffstat (limited to 'Src/builtin.c')
-rw-r--r--Src/builtin.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index 01e6b479b..1f41b1e87 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -4701,9 +4701,10 @@ int
bin_dot(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
{
char **old, *old0 = NULL;
- int ret, diddot = 0, dotdot = 0;
+ int diddot = 0, dotdot = 0;
char *s, **t, *enam, *arg0, *buf;
struct stat st;
+ enum source_return ret;
if (!*argv)
return 0;
@@ -4719,14 +4720,14 @@ bin_dot(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
}
s = unmeta(enam);
errno = ENOENT;
- ret = 1;
+ ret = SOURCE_NOT_FOUND;
/* for source only, check in current directory first */
if (*name != '.' && access(s, F_OK) == 0
&& stat(s, &st) >= 0 && !S_ISDIR(st.st_mode)) {
diddot = 1;
ret = source(enam);
}
- if (ret) {
+ if (ret == SOURCE_NOT_FOUND) {
/* use a path with / in it */
for (s = arg0; *s; s++)
if (*s == '/') {
@@ -4739,7 +4740,8 @@ bin_dot(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
ret = source(arg0);
break;
}
- if (!*s || (ret && isset(PATHDIRS) && diddot < 2 && dotdot == 0)) {
+ if (!*s || (ret == SOURCE_NOT_FOUND &&
+ isset(PATHDIRS) && diddot < 2 && dotdot == 0)) {
pushheap();
/* search path for script */
for (t = path; *t; t++) {
@@ -4766,12 +4768,12 @@ bin_dot(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
freearray(pparams);
pparams = old;
}
- if (ret)
+ if (ret == SOURCE_NOT_FOUND)
zwarnnam(name, "%e: %s", errno, enam);
zsfree(arg0);
if (old0)
argzero = old0;
- return ret ? ret : lastval;
+ return ret == SOURCE_OK ? lastval : 127 + ret;
}
/*