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
This commit is contained in:
peter 1995-11-14 01:04:52 +00:00
parent c00ea1637d
commit 0017db9c16

View File

@ -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;