diff options
author | peter <peter@FreeBSD.org> | 1995-11-14 01:04:52 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1995-11-14 01:04:52 +0000 |
commit | c140e951e591f4797f4c5e9d95f4231c75bb4d69 (patch) | |
tree | 07d9c006cb2f014a091c66354a9cfddc39eaa607 /bin/sh | |
parent | 81160ba677cdfa5e85a705a85d529add42427dcd (diff) | |
download | FreeBSD-src-c140e951e591f4797f4c5e9d95f4231c75bb4d69.zip FreeBSD-src-c140e951e591f4797f4c5e9d95f4231c75bb4d69.tar.gz |
A fix for the "cd -" coredump on a brand new /bin/sh. The problem was
noticed on a NetBSD bugs mailing list but this is entirely my own work.
Inspired by: Scott Reynolds <scottr@plexus.com>, for NetBSD
Diffstat (limited to 'bin/sh')
-rw-r--r-- | bin/sh/cd.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/bin/sh/cd.c b/bin/sh/cd.c index ac44069..31a0001 100644 --- a/bin/sh/cd.c +++ b/bin/sh/cd.c @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: cd.c,v 1.3 1994/11/06 01:29:26 jkh Exp $ + * $Id: cd.c,v 1.4 1994/12/26 13:02:05 bde Exp $ */ #ifndef lint @@ -92,7 +92,10 @@ cdcmd(argc, argv) char **argv; { dest = "."; if (dest[0] == '-' && dest[1] == '\0') { dest = prevdir ? prevdir : curdir; - print = 1; + if (dest) + print = 1; + else + dest = "."; } if (*dest == '/' || (path = bltinlookup("CDPATH", 1)) == NULL) path = nullstr; |