Fix core dump when doing

mount fileserver:/somepath
by not passing a NULL pointer to getfsfile(3).
(Bug was introduced in rev 1.74 as part of fix for PR 28644.)
This commit is contained in:
lukem 2005-03-18 04:24:35 +00:00
parent be04a114e9
commit 6ac207736c
1 changed files with 7 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: mount.c,v 1.76 2005/02/05 14:44:46 xtraeme Exp $ */
/* $NetBSD: mount.c,v 1.77 2005/03/18 04:24:35 lukem Exp $ */
/*
* Copyright (c) 1980, 1989, 1993, 1994
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1989, 1993, 1994\n\
#if 0
static char sccsid[] = "@(#)mount.c 8.25 (Berkeley) 5/8/95";
#else
__RCSID("$NetBSD: mount.c,v 1.76 2005/02/05 14:44:46 xtraeme Exp $");
__RCSID("$NetBSD: mount.c,v 1.77 2005/03/18 04:24:35 lukem Exp $");
#endif
#endif /* not lint */
@ -211,7 +211,7 @@ main(int argc, char *argv[])
if (init_flags & MNT_UPDATE) {
/*
* Try lookin up the canonical path first,
* Try looking up the canonical path first,
* then try exactly what the user entered.
*/
if ((canonical_path == NULL ||
@ -235,11 +235,12 @@ main(int argc, char *argv[])
mountopts = NULL;
} else {
/*
* Try lookin up the canonical path first,
* Try looking up the canonical path first,
* then try exactly what the user entered.
*/
if ((fs = getfsfile(canonical_path)) == NULL &&
(fs = getfsspec(canonical_path)) == NULL)
if (canonical_path == NULL ||
((fs = getfsfile(canonical_path)) == NULL &&
(fs = getfsspec(canonical_path)) == NULL))
{
if ((fs = getfsfile(*argv)) == NULL &&
(fs = getfsspec(*argv)) == NULL)