diff options
| author | Jilles Tjoelker <jilles@FreeBSD.org> | 2012-01-27 20:53:37 +0000 |
|---|---|---|
| committer | Jilles Tjoelker <jilles@FreeBSD.org> | 2012-01-27 20:53:37 +0000 |
| commit | bcd2f81f1ce8631a216ff95ec349ecaf308b482a (patch) | |
| tree | 646c2a0e8eaa699329e7b24e7f5a559753fe729c /bin | |
| parent | e108472917b8e09b504fd51af04956646ac3c612 (diff) | |
Notes
Diffstat (limited to 'bin')
| -rw-r--r-- | bin/sh/cd.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/bin/sh/cd.c b/bin/sh/cd.c index 6fb10390a239..1330c850c7fb 100644 --- a/bin/sh/cd.c +++ b/bin/sh/cd.c @@ -130,7 +130,12 @@ cdcmd(int argc, char **argv) (path = bltinlookup("CDPATH", 1)) == NULL) path = nullstr; while ((p = padvance(&path, dest)) != NULL) { - if (stat(p, &statb) >= 0 && S_ISDIR(statb.st_mode)) { + if (stat(p, &statb) < 0) { + if (errno != ENOENT) + errno1 = errno; + } else if (!S_ISDIR(statb.st_mode)) + errno1 = ENOTDIR; + else { if (!print) { /* * XXX - rethink |
