Patchwork mount.cifs: strip leading delimiter off of prefixpath option

login
register
mail settings
Submitter Jeff Layton
Date April 29, 2010, 3:05 p.m.
Message ID <1272553520-22066-1-git-send-email-jlayton@samba.org>
Download mbox | patch
Permalink /patch/51298/
State New
Headers show

Comments

Jeff Layton - April 29, 2010, 3:05 p.m.
...the kernel doesn't expect to see it and it causes a regression
when mounting some UNCs.

Reported-by: Ales Zelinka <azelinka@redhat.com>
Signed-off-by: Jeff Layton <jlayton@samba.org>
---
 mount.cifs.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Patch

diff --git a/mount.cifs.c b/mount.cifs.c
index 1040e8b..6e5afe3 100644
--- a/mount.cifs.c
+++ b/mount.cifs.c
@@ -1168,7 +1168,7 @@  static int parse_unc(const char *unc_name, struct parsed_mount_info *parsed_info
 		return EX_USAGE;
 	}
 
-	prepath = share + sharelen;
+	prepath = share + sharelen + 1;
 	prepathlen = strlen(prepath);
 
 	if (prepathlen + 1 > sizeof(parsed_info->prefix)) {
@@ -1669,6 +1669,7 @@  int main(int argc, char **argv)
 		goto mount_exit;
 	}
 
+	/* lengths of different strings + slashes + trailing \0 */
 	dev_len = strnlen(parsed_info->host, sizeof(parsed_info->host)) +
 	    strnlen(parsed_info->share, sizeof(parsed_info->share)) +
 	    strnlen(parsed_info->prefix, sizeof(parsed_info->prefix)) +
@@ -1684,6 +1685,7 @@  int main(int argc, char **argv)
 	strlcat(dev_name, parsed_info->host, dev_len);
 	strlcat(dev_name, "/", dev_len);
 	strlcat(dev_name, parsed_info->share, dev_len);
+	strlcat(dev_name, "/", dev_len);
 	strlcat(dev_name, parsed_info->prefix, dev_len);
 
 	currentaddress = parsed_info->addrlist;