diff mbox

[2/2] nfsmount.conf: remove duplicate 'timeo' from the parsing string

Message ID 1381267825-27457-2-git-send-email-steved@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Steve Dickson Oct. 8, 2013, 9:30 p.m. UTC
When the 'timeo' option is specified in multiple sections of
the nfsmount.conf file, each instance is added to the parsing
string. This patch make the first instance override any others.

Signed-off-by: Steve Dickson <steved@redhat.com>
---
 utils/mount/configfile.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Steve Dickson Oct. 21, 2013, 2:04 p.m. UTC | #1
On 08/10/13 17:30, Steve Dickson wrote:
> When the 'timeo' option is specified in multiple sections of
> the nfsmount.conf file, each instance is added to the parsing
> string. This patch make the first instance override any others.
> 
> Signed-off-by: Steve Dickson <steved@redhat.com>
Committed... 

steved.
> ---
>  utils/mount/configfile.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/utils/mount/configfile.c b/utils/mount/configfile.c
> index 6985ed9..39d3741 100644
> --- a/utils/mount/configfile.c
> +++ b/utils/mount/configfile.c
> @@ -186,8 +186,18 @@ char *lookup_entry(char *opt)
>  {
>  	struct entry *entry;
>  	char *alias = is_alias(opt);
> +	char *ptr;
>  
>  	SLIST_FOREACH(entry, &head, entries) {
> +		/*
> +		 * Only check the left side or options that use '='
> +		 */
> +		if ((ptr = strchr(entry->opt, '=')) != 0) {
> +			int len = (int) (ptr - entry->opt);
> +
> +			if (strncasecmp(entry->opt, opt, len) == 0)
> +				return opt;
> +		}
>  		if (strcasecmp(entry->opt, opt) == 0)
>  			return opt;
>  		if (alias && strcasecmp(entry->opt, alias) == 0)
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/utils/mount/configfile.c b/utils/mount/configfile.c
index 6985ed9..39d3741 100644
--- a/utils/mount/configfile.c
+++ b/utils/mount/configfile.c
@@ -186,8 +186,18 @@  char *lookup_entry(char *opt)
 {
 	struct entry *entry;
 	char *alias = is_alias(opt);
+	char *ptr;
 
 	SLIST_FOREACH(entry, &head, entries) {
+		/*
+		 * Only check the left side or options that use '='
+		 */
+		if ((ptr = strchr(entry->opt, '=')) != 0) {
+			int len = (int) (ptr - entry->opt);
+
+			if (strncasecmp(entry->opt, opt, len) == 0)
+				return opt;
+		}
 		if (strcasecmp(entry->opt, opt) == 0)
 			return opt;
 		if (alias && strcasecmp(entry->opt, alias) == 0)