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 Wemm 1995-11-14 01:04:52 +00:00
parent ecd506c811
commit 8d7d5ceaa5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=12273

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;