summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Mayhew <smayhew@redhat.com>2013-08-19 13:03:31 -0400
committerSteve Dickson <steved@redhat.com>2013-08-19 13:04:53 -0400
commitfbbdcf6d77318bf95389be71a46ffc311580f975 (patch)
tree944895951d1ab0898284a514130d8d66c841bbe1
parent95f7dee0fe4ee13c17f31441f5cfe7600381869f (diff)
downloadnfs-utils-fbbdcf6d77318bf95389be71a46ffc311580f975.tar.gz
nfs-utils-fbbdcf6d77318bf95389be71a46ffc311580f975.tar.xz
nfs-utils-fbbdcf6d77318bf95389be71a46ffc311580f975.zip
mount.nfs: improve handling of bg, fg, and sloppy in nfsmount.conf
This patch makes 2 small improvements to the parsing of the bg, fg, and sloppy mount options in nfsmount.conf. 1. "bg" and "fg" negate should each other. "Background=True" should mean "bg" and "Background=False" should mean "fg". The same applies to "Foreground". 2. Once we see "Sloppy=False" while parsing the configuration file we should ignore subsequent occurrences of the sloppy option. This will preserve the "right-most setting wins" behavior for the sloppy mount option. Acked-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Scott Mayhew <smayhew@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
-rw-r--r--utils/mount/configfile.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/utils/mount/configfile.c b/utils/mount/configfile.c
index 1f1b6e7..68b9f93 100644
--- a/utils/mount/configfile.c
+++ b/utils/mount/configfile.c
@@ -73,6 +73,8 @@ struct mnt_alias {
};
int mnt_alias_sz = (sizeof(mnt_alias_tab)/sizeof(mnt_alias_tab[0]));
+static int strict;
+
/*
* See if the option is an alias, if so return the
* real mount option along with the argument type.
@@ -310,7 +312,15 @@ conf_parse_mntopts(char *section, char *arg, char *opts)
if (strcasecmp(value, "false") == 0) {
if (argtype != MNT_NOARG)
snprintf(buf, BUFSIZ, "no%s", field);
+ else if (strcasecmp(field, "bg") == 0)
+ snprintf(buf, BUFSIZ, "fg");
+ else if (strcasecmp(field, "fg") == 0)
+ snprintf(buf, BUFSIZ, "bg");
+ else if (strcasecmp(field, "sloppy") == 0)
+ strict = 1;
} else if (strcasecmp(value, "true") == 0) {
+ if ((strcasecmp(field, "sloppy") == 0) && strict)
+ continue;
snprintf(buf, BUFSIZ, "%s", field);
} else {
nvalue = strdup(value);
@@ -345,6 +355,7 @@ char *conf_get_mntopts(char *spec, char *mount_point,
char *ptr, *server, *config_opts;
int optlen = 0;
+ strict = 0;
SLIST_INIT(&head);
list_size = 0;
/*