X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=utils%2Fmount%2Fconfigfile.c;h=6f2ee75f11c9c159124f2127914c819f12c9bacf;hp=28b722c7e101034fe9fde2a7039b221c69dd29eb;hb=9a5293a10551c03b4fb976503dd24da569fcadb3;hpb=2f61f62ac777cc03e30513f6fd3699f9e2f04e27 diff --git a/utils/mount/configfile.c b/utils/mount/configfile.c index 28b722c..6f2ee75 100644 --- a/utils/mount/configfile.c +++ b/utils/mount/configfile.c @@ -192,26 +192,46 @@ void free_all(void) } } static char *versions[] = {"v2", "v3", "v4", "vers", "nfsvers", NULL}; -int inline check_vers(char *mopt, char *field) +static int +check_vers(char *mopt, char *field) { - int i; + int i, found=0; - if (strncmp("mountvers", field, strlen("mountvers")) != 0) { - for (i=0; versions[i]; i++) - if (strcasestr(mopt, versions[i]) != NULL) - return 1; + /* + * First check to see if the config setting is one + * of the many version settings + */ + for (i=0; versions[i]; i++) { + if (strcasestr(field, versions[i]) != NULL) { + found++; + break; + } + } + if (!found) + return 0; + /* + * It appears the version is being set, now see + * if the version appears on the command + */ + for (i=0; versions[i]; i++) { + if (strcasestr(mopt, versions[i]) != NULL) + return 1; } + return 0; } unsigned long config_default_vers; unsigned long config_default_proto; +extern sa_family_t config_default_family; + /* * Check to see if a default value is being set. * If so, set the appropriate global value which will * be used as the initial value in the server negation. */ -int inline default_value(char *mopt) +static int +default_value(char *mopt) { struct mount_options *options = NULL; int dftlen = strlen("default"); @@ -227,6 +247,10 @@ int inline default_value(char *mopt) xlog_warn("Unable to set default protocol : %s", strerror(errno)); } + if (!nfs_nfs_proto_family(options, &config_default_family)) { + xlog_warn("Unable to set default family : %s", + strerror(errno)); + } } else { xlog_warn("Unable to alloc memory for default protocol"); }