]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - utils/mount/stropts.c
Use the default protocol and version values, when they
[nfs-utils.git] / utils / mount / stropts.c
index 069bdc1ca6aa90d6120434890099e0583a7c6ab4..ceefdb0fc24cecb5a5215db809fbe01fece76251 100644 (file)
@@ -45,6 +45,7 @@
 #include "parse_opt.h"
 #include "version.h"
 #include "parse_dev.h"
 #include "parse_opt.h"
 #include "version.h"
 #include "parse_dev.h"
+#include "conffile.h"
 
 #ifndef NFS_PROGRAM
 #define NFS_PROGRAM    (100003)
 
 #ifndef NFS_PROGRAM
 #define NFS_PROGRAM    (100003)
@@ -283,6 +284,14 @@ static int nfs_validate_options(struct nfsmount_info *mi)
                if (option && strcmp(option, "rdma") == 0)
                        mi->version = 3;
        }
                if (option && strcmp(option, "rdma") == 0)
                        mi->version = 3;
        }
+       /*
+        * Use the default value set in the config file when
+        * the version has not been explicitly set.
+        */
+       if (mi->version == 0 && config_default_vers) {
+               if (config_default_vers < 4)
+                       mi->version = config_default_vers;
+       }
 
        if (!nfs_append_sloppy_option(mi->options))
                return 0;
 
        if (!nfs_append_sloppy_option(mi->options))
                return 0;