diff options
author | jilles <jilles@FreeBSD.org> | 2011-05-25 21:38:16 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2011-05-25 21:38:16 +0000 |
commit | b5e2a8cd97132ce3eb4e8b74243a97ec8729b4ef (patch) | |
tree | faaf07f7f8097d61dddce36b22793b0f67cb2598 | |
parent | 5568736ae231b28ba73789dca29199deb20322ba (diff) | |
download | FreeBSD-src-b5e2a8cd97132ce3eb4e8b74243a97ec8729b4ef.zip FreeBSD-src-b5e2a8cd97132ce3eb4e8b74243a97ec8729b4ef.tar.gz |
sh: Show errno messages in cd.
-rw-r--r-- | bin/sh/cd.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/bin/sh/cd.c b/bin/sh/cd.c index 776bdba..2cd9daf 100644 --- a/bin/sh/cd.c +++ b/bin/sh/cd.c @@ -86,6 +86,7 @@ cdcmd(int argc, char **argv) struct stat statb; int ch, phys, print = 0, getcwderr = 0; int rc; + int errno1 = ENOENT; optreset = 1; optind = 1; opterr = 0; /* initialize getopt */ phys = Pflag; @@ -138,9 +139,11 @@ cdcmd(int argc, char **argv) rc = docd(p, print, phys); if (rc >= 0) return getcwderr ? rc : 0; + if (errno != ENOENT) + errno1 = errno; } } - error("can't cd to %s", dest); + error("%s: %s", dest, strerror(errno1)); /*NOTREACHED*/ return 0; } |