From 1f45d4d4ebc22f766cdd77d84f0a5c431f3c8d3b Mon Sep 17 00:00:00 2001 From: Bruce Evans Date: Tue, 1 Apr 1997 14:15:30 +0000 Subject: [PATCH] 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. --- sbin/mountd/mountd.c | 8 ++++---- usr.sbin/mountd/mountd.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sbin/mountd/mountd.c b/sbin/mountd/mountd.c index aef2583fe19..472440e8bac 100644 --- a/sbin/mountd/mountd.c +++ b/sbin/mountd/mountd.c @@ -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 @@ -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); } diff --git a/usr.sbin/mountd/mountd.c b/usr.sbin/mountd/mountd.c index aef2583fe19..472440e8bac 100644 --- a/usr.sbin/mountd/mountd.c +++ b/usr.sbin/mountd/mountd.c @@ -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 @@ -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); }