diff options
author | Steve Dickson <steved@redhat.com> | 2013-10-21 10:02:12 -0400 |
---|---|---|
committer | Steve Dickson <steved@redhat.com> | 2013-10-21 10:03:45 -0400 |
commit | a4cffdb22fd11f37bfd1ccffd91aacd4c77cba5e (patch) | |
tree | eb3f64e167075a4eb7e04dd3104e241696a527d0 | |
parent | 23118dcce61979da9d3c007cdde1405273de2d8f (diff) | |
download | nfs-utils-a4cffdb22fd11f37bfd1ccffd91aacd4c77cba5e.tar.gz nfs-utils-a4cffdb22fd11f37bfd1ccffd91aacd4c77cba5e.tar.xz nfs-utils-a4cffdb22fd11f37bfd1ccffd91aacd4c77cba5e.zip |
nfsmount.conf: Remove duplicate 'bg' and 'fg' from parsing string.
When the 'Background' and/or 'Foreground' options are set
in multiple sections of the nfsmount.conf file, each instance
gets added to the parsing string. This patch makes the first
instance of either option override the any others.
Signed-off-by: Steve Dickson <steved@redhat.com>
-rw-r--r-- | utils/mount/configfile.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/utils/mount/configfile.c b/utils/mount/configfile.c index 68b9f93..6985ed9 100644 --- a/utils/mount/configfile.c +++ b/utils/mount/configfile.c @@ -164,6 +164,20 @@ add_entry(char *opt) SLIST_INSERT_HEAD(&head, entry, entries); } /* + * Check the alias list to see if the given + * opt is a alias + */ +char *is_alias(char *opt) +{ + int i; + + for (i=0; i < mnt_alias_sz; i++) { + if (strcasecmp(opt, mnt_alias_tab[i].alias) == 0) + return mnt_alias_tab[i].opt; + } + return NULL; +} +/* * See if the given entry exists if the link list, * if so return that entry */ @@ -171,10 +185,21 @@ inline static char *lookup_entry(char *opt) { struct entry *entry; + char *alias = is_alias(opt); SLIST_FOREACH(entry, &head, entries) { if (strcasecmp(entry->opt, opt) == 0) return opt; + if (alias && strcasecmp(entry->opt, alias) == 0) + return opt; + if (alias && strcasecmp(alias, "fg") == 0) { + if (strcasecmp(entry->opt, "bg") == 0) + return opt; + } + if (alias && strcasecmp(alias, "bg") == 0) { + if (strcasecmp(entry->opt, "fg") == 0) + return opt; + } } return NULL; } |