diff options
| author | Csaba Henk <csaba@gluster.com> | 2010-09-30 12:44:26 +0000 | 
|---|---|---|
| committer | Vijay Bellur <vijay@dev.gluster.com> | 2010-10-01 03:41:29 -0700 | 
| commit | 55c6e672503a2451186e17b9c1b7daf6e3ae5463 (patch) | |
| tree | bdb181335cb472b83539ed6860d6630dedaf2d59 /contrib/fuse-util/fusermount.c | |
| parent | 828829a9cf7b925709f9a1f289d9a6cb94b74dd8 (diff) | |
contrib/fuse: update from upstream [555d6b50 in git://fuse.git.sourceforge.net/fuse/fuse]
"""
commit 555d6b504308eac6b976321ce938ee4bec62c354
Author: Miklos Szeredi <mszeredi@suse.cz>
Date:   Tue Sep 28 10:13:24 2010 +0200
    Fix option escaping for fusermount.
    If the "fsname=" option contained a comma then the option parser in
    fusermount was confused (Novell bugzilla #641480).  Fix by escaping
    commas when passing them over to fusermount.
    Reported by Jan Engelhardt
"""
Signed-off-by: Csaba Henk <csaba@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 1752 (sync with upstream for "Fix option escaping for fusermount.")
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1752
Diffstat (limited to 'contrib/fuse-util/fusermount.c')
| -rw-r--r-- | contrib/fuse-util/fusermount.c | 20 | 
1 files changed, 17 insertions, 3 deletions
diff --git a/contrib/fuse-util/fusermount.c b/contrib/fuse-util/fusermount.c index ae779d3fb..39da9b6a0 100644 --- a/contrib/fuse-util/fusermount.c +++ b/contrib/fuse-util/fusermount.c @@ -649,7 +649,9 @@ static int opt_eq(const char *s, unsigned len, const char *opt)  static int get_string_opt(const char *s, unsigned len, const char *opt,  			  char **val)  { +	int i;  	unsigned opt_len = strlen(opt); +	char *d;  	if (*val)  		free(*val); @@ -659,8 +661,15 @@ static int get_string_opt(const char *s, unsigned len, const char *opt,  		return 0;  	} -	memcpy(*val, s + opt_len, len - opt_len); -	(*val)[len - opt_len] = '\0'; +	d = *val; +	s += opt_len; +	len -= opt_len; +	for (i = 0; i < len; i++) { +		if (s[i] == '\\' && i + 1 < len) +			i++; +		*d++ = s[i]; +	} +	*d = '\0';  	return 1;  } @@ -691,7 +700,12 @@ static int do_mount(const char *mnt, char **typep, mode_t rootmode,  		unsigned len;  		const char *fsname_str = "fsname=";  		const char *subtype_str = "subtype="; -		for (len = 0; s[len] && s[len] != ','; len++); +		for (len = 0; s[len]; len++) { +			if (s[len] == '\\' && s[len + 1]) +				len++; +			else if (s[len] == ',') +				break; +		}  		if (begins_with(s, fsname_str)) {  			if (!get_string_opt(s, len, fsname_str, &fsname))  				goto err;  | 
