Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/mount_nfs Catch error code from mount command, and if i...



details:   https://anonhg.NetBSD.org/src/rev/4748408fd04f
branches:  trunk
changeset: 532838:4748408fd04f
user:      wrstuden <wrstuden%NetBSD.org@localhost>
date:      Sun Jun 16 02:27:31 2002 +0000

description:
Catch error code from mount command, and if it's the
error given when we ask for a v3 mount on a v2-only kernel,
*and* we weren't forcing v3, try the mount again as a v2 mount
before erroring out.

diffstat:

 sbin/mount_nfs/mount_nfs.c |  16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diffs (44 lines):

diff -r 09e6c03421f2 -r 4748408fd04f sbin/mount_nfs/mount_nfs.c
--- a/sbin/mount_nfs/mount_nfs.c        Sun Jun 16 00:38:33 2002 +0000
+++ b/sbin/mount_nfs/mount_nfs.c        Sun Jun 16 02:27:31 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mount_nfs.c,v 1.32 2002/05/29 02:19:56 cjs Exp $       */
+/*     $NetBSD: mount_nfs.c,v 1.33 2002/06/16 02:27:31 wrstuden Exp $  */
 
 /*
  * Copyright (c) 1992, 1993, 1994
@@ -46,7 +46,7 @@
 #if 0
 static char sccsid[] = "@(#)mount_nfs.c        8.11 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: mount_nfs.c,v 1.32 2002/05/29 02:19:56 cjs Exp $");
+__RCSID("$NetBSD: mount_nfs.c,v 1.33 2002/06/16 02:27:31 wrstuden Exp $");
 #endif
 #endif /* not lint */
 
@@ -211,7 +211,7 @@
        int argc;
        char *argv[];
 {
-       int c;
+       int c, retval;
        struct nfs_args *nfsargsp;
        struct nfs_args nfsargs;
        struct nfsd_cargs ncd;
@@ -448,7 +448,15 @@
 
        if (!getnfsargs(spec, nfsargsp))
                exit(1);
-       if (mount(MOUNT_NFS, name, mntflags, nfsargsp))
+       if ((retval = mount(MOUNT_NFS, name, mntflags, nfsargsp))) {
+               /* Did we just default to v3 on a v2-only kernel?
+                * If so, default to v2 & try again */
+               if ((errno == EPROGMISMATCH) && !force3) {
+                       nfsargsp->flags &= ~NFSMNT_NFSV3;
+                       retval = mount(MOUNT_NFS, name, mntflags, nfsargsp);
+               }
+       }
+       if (retval)
                err(1, "%s on %s", ospec, name);
        if (nfsargsp->flags & (NFSMNT_NQNFS | NFSMNT_KERB)) {
                if ((opflags & ISBGRND) == 0) {



Home | Main Index | Thread Index | Old Index