summaryrefslogtreecommitdiffstats
path: root/contrib/fuse-lib/mount.c
diff options
context:
space:
mode:
authorCsaba Henk <csaba@gluster.com>2010-09-30 12:44:26 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-10-01 03:41:29 -0700
commit55c6e672503a2451186e17b9c1b7daf6e3ae5463 (patch)
treebdb181335cb472b83539ed6860d6630dedaf2d59 /contrib/fuse-lib/mount.c
parent828829a9cf7b925709f9a1f289d9a6cb94b74dd8 (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-lib/mount.c')
-rw-r--r--contrib/fuse-lib/mount.c40
1 files changed, 38 insertions, 2 deletions
diff --git a/contrib/fuse-lib/mount.c b/contrib/fuse-lib/mount.c
index e88293b38c7..376d0668668 100644
--- a/contrib/fuse-lib/mount.c
+++ b/contrib/fuse-lib/mount.c
@@ -589,11 +589,41 @@ fuse_mount_sys (const char *mountpoint, char *fsname, char *mnt_param)
return fd;
}
+static char *
+escape (char *s)
+{
+ size_t len = 0;
+ char *p = NULL;
+ char *q = NULL;
+ char *e = NULL;
+
+ for (p = s; *p; p++) {
+ if (*p == ',')
+ len++;
+ len++;
+ }
+
+ e = CALLOC (1, len + 1);
+ if (!e)
+ return NULL;
+
+ for (p = s, q = e; *p; p++, q++) {
+ if (*p == ',') {
+ *q = '\\';
+ q++;
+ }
+ *q = *p;
+ }
+
+ return e;
+}
+
int
gf_fuse_mount (const char *mountpoint, char *fsname, char *mnt_param)
{
int fd = -1, rv = -1;
char *fm_mnt_params = NULL, *p = NULL;
+ char *efsname = NULL;
fd = fuse_mount_sys (mountpoint, fsname, mnt_param);
if (fd == -1) {
@@ -602,10 +632,16 @@ gf_fuse_mount (const char *mountpoint, char *fsname, char *mnt_param)
"retry to mount via fusermount",
strerror (errno));
+ efsname = escape (fsname);
+ if (!efsname) {
+ GFFUSE_LOGERR ("Out of memory");
+
+ return -1;
+ }
rv = asprintf (&fm_mnt_params,
"%s,fsname=%s,nonempty,subtype=glusterfs",
- mnt_param, fsname);
-
+ mnt_param, efsname);
+ FREE (efsname);
if (rv == -1) {
GFFUSE_LOGERR ("Out of memory");