]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
mount.nfs: silently fails when the network protocol is not found
authorSteve Dickson <steved@redhat.com>
Thu, 3 Jun 2010 12:53:22 +0000 (08:53 -0400)
committerSteve Dickson <steved@redhat.com>
Tue, 22 Jun 2010 13:52:51 +0000 (09:52 -0400)
mount.nfs should display some type of error diagnostics when
the network protocol can not be determined.

Signed-off-by: Steve Dickson <steved@redhat.com>
utils/mount/network.c
utils/mount/stropts.c

index d9903ed44c492cc3fccedfa04ea2b38ab5a3b83f..ffb18abc356fe9526e5caf2040daaed19273ede9 100644 (file)
@@ -1311,6 +1311,8 @@ nfs_nfs_protocol(struct mount_options *options, unsigned long *protocol)
                if (option != NULL) {
                        if (!nfs_get_proto(option, &family, protocol)) {
                                errno = EPROTONOSUPPORT;
+                               nfs_error(_("%s: Failed to find '%s' protocol"), 
+                                       progname, option);
                                return 0;
                        }
                        return 1;
@@ -1399,8 +1401,13 @@ int nfs_nfs_proto_family(struct mount_options *options,
        case 2: /* proto */
                option = po_get(options, "proto");
                if (option != NULL &&
-                   !nfs_get_proto(option, &tmp_family, &protocol))
-                       goto out_err;
+                   !nfs_get_proto(option, &tmp_family, &protocol)) {
+
+                       nfs_error(_("%s: Failed to find '%s' protocol"), 
+                               progname, option);
+                       errno = EPROTONOSUPPORT;
+                       return 0;
+               }
        }
 
        if (!nfs_verify_family(tmp_family))
@@ -1492,6 +1499,8 @@ nfs_mount_protocol(struct mount_options *options, unsigned long *protocol)
        if (option != NULL) {
                if (!nfs_get_proto(option, &family, protocol)) {
                        errno = EPROTONOSUPPORT;
+                       nfs_error(_("%s: Failed to find '%s' protocol"), 
+                               progname, option);
                        return 0;
                }
                return 1;
@@ -1551,8 +1560,12 @@ int nfs_mount_proto_family(struct mount_options *options,
 
        option = po_get(options, "mountproto");
        if (option != NULL) {
-               if (!nfs_get_proto(option, &tmp_family, &protocol))
+               if (!nfs_get_proto(option, &tmp_family, &protocol)) {
+                       nfs_error(_("%s: Failed to find '%s' protocol"), 
+                               progname, option);
+                       errno = EPROTONOSUPPORT;
                        goto out_err;
+               }
                if (!nfs_verify_family(tmp_family))
                        goto out_err;
                *family = tmp_family;
index 98557d2988f487f531f0e250ac85af764c04b6ee..024140082fcf56f65968453ca912158ab73f3668 100644 (file)
@@ -538,7 +538,10 @@ nfs_rewrite_pmap_mount_options(struct mount_options *options)
 
        if (!nfs_construct_new_options(options, nfs_saddr, &nfs_pmap,
                                        mnt_saddr, &mnt_pmap)) {
-               errno = EINVAL;
+               if (rpc_createerr.cf_stat == RPC_UNKNOWNPROTO)
+                       errno = EPROTONOSUPPORT;
+               else
+                       errno = EINVAL;
                return 0;
        }
 
@@ -586,18 +589,21 @@ static int nfs_do_mount_v3v2(struct nfsmount_info *mi,
                errno = ENOMEM;
                return result;
        }
-
+       errno = 0;
        if (!nfs_append_addr_option(sap, salen, options)) {
-               errno = EINVAL;
+               if (errno == 0)
+                       errno = EINVAL;
                goto out_fail;
        }
 
        if (!nfs_fix_mounthost_option(options, mi->hostname)) {
-               errno = EINVAL;
+               if (errno == 0)
+                       errno = EINVAL;
                goto out_fail;
        }
        if (!mi->fake && !nfs_verify_lock_option(options)) {
-               errno = EINVAL;
+               if (errno == 0)
+                       errno = EINVAL;
                goto out_fail;
        }