Don't fail when the vfs.nfs.nfs_privport sysctl doesn't exist

(presumably because the kernel is old).  Moved the declaration of a
variable realated to this sysctl outside of an unrelated ifdef.

Not fixed:
- this sysctl is badly named (nfs occurs twice).
- it's silly to have for FreeBSD in FreeBSD code, especially when
  only half of the FreeBSD-dependent code is ifdefed.
This commit is contained in:
Bruce Evans 1997-04-01 14:15:30 +00:00
parent 67fd3b9895
commit 1f45d4d4eb
2 changed files with 8 additions and 8 deletions

View File

@ -43,7 +43,7 @@ static char copyright[] =
#ifndef lint
/*static char sccsid[] = "@(#)mountd.c 8.15 (Berkeley) 5/1/95"; */
static const char rcsid[] =
"$Id: mountd.c,v 1.15 1997/03/27 20:00:48 guido Exp $";
"$Id: mountd.c,v 1.16 1997/03/29 03:32:49 imp Exp $";
#endif /*not lint*/
#include <sys/param.h>
@ -254,10 +254,10 @@ main(argc, argv)
{
SVCXPRT *udptransp, *tcptransp;
int c;
int mib[3];
#ifdef __FreeBSD__
struct vfsconf vfc;
int error;
int mib[3];
error = getvfsbyname("nfs", &vfc);
if (error && vfsisloadable("nfs")) {
@ -321,8 +321,8 @@ main(argc, argv)
mib[0] = CTL_VFS;
mib[1] = MOUNT_NFS;
mib[2] = NFS_NFSPRIVPORT;
if (sysctl(mib, 3, NULL, NULL,
&resvport_only, sizeof(resvport_only)) != 0) {
if (sysctl(mib, 3, NULL, NULL, &resvport_only,
sizeof(resvport_only)) != 0 && errno != ENOENT) {
syslog(LOG_ERR, "sysctl: %m");
exit(1);
}

View File

@ -43,7 +43,7 @@ static char copyright[] =
#ifndef lint
/*static char sccsid[] = "@(#)mountd.c 8.15 (Berkeley) 5/1/95"; */
static const char rcsid[] =
"$Id: mountd.c,v 1.15 1997/03/27 20:00:48 guido Exp $";
"$Id: mountd.c,v 1.16 1997/03/29 03:32:49 imp Exp $";
#endif /*not lint*/
#include <sys/param.h>
@ -254,10 +254,10 @@ main(argc, argv)
{
SVCXPRT *udptransp, *tcptransp;
int c;
int mib[3];
#ifdef __FreeBSD__
struct vfsconf vfc;
int error;
int mib[3];
error = getvfsbyname("nfs", &vfc);
if (error && vfsisloadable("nfs")) {
@ -321,8 +321,8 @@ main(argc, argv)
mib[0] = CTL_VFS;
mib[1] = MOUNT_NFS;
mib[2] = NFS_NFSPRIVPORT;
if (sysctl(mib, 3, NULL, NULL,
&resvport_only, sizeof(resvport_only)) != 0) {
if (sysctl(mib, 3, NULL, NULL, &resvport_only,
sizeof(resvport_only)) != 0 && errno != ENOENT) {
syslog(LOG_ERR, "sysctl: %m");
exit(1);
}