Source-Changes-HG archive

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

[src/netbsd-1-6]: src/sbin/mount_nfs Pull up revision 1.33 (requested by wrst...



details:   https://anonhg.NetBSD.org/src/rev/de294ec82891
branches:  netbsd-1-6
changeset: 527963:de294ec82891
user:      lukem <lukem%NetBSD.org@localhost>
date:      Tue Jun 18 14:05:36 2002 +0000

description:
Pull up revision 1.33 (requested by wrstuden in ticket #290):
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 b8f7b46c73d7 -r de294ec82891 sbin/mount_nfs/mount_nfs.c
--- a/sbin/mount_nfs/mount_nfs.c        Tue Jun 18 13:57:53 2002 +0000
+++ b/sbin/mount_nfs/mount_nfs.c        Tue Jun 18 14:05:36 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mount_nfs.c,v 1.31 2002/03/02 12:25:23 mrg Exp $       */
+/*     $NetBSD: mount_nfs.c,v 1.31.2.1 2002/06/18 14:05:36 lukem 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.31 2002/03/02 12:25:23 mrg Exp $");
+__RCSID("$NetBSD: mount_nfs.c,v 1.31.2.1 2002/06/18 14:05:36 lukem 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