From ebdde932a6ec1923c0187a3e4dad9d54539f621a Mon Sep 17 00:00:00 2001 From: "mooredan@suncup.net" Date: Wed, 9 Mar 2011 20:55:31 +0000 Subject: [PATCH] Strip the trailing '/' characters off of the url= option's argument Resolves issue #171 git-svn-id: http://s3fs.googlecode.com/svn/trunk@336 df820570-a93a-0410-bd06-b72b767a4274 --- src/s3fs.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/s3fs.cpp b/src/s3fs.cpp index c4dc55f..79b4326 100644 --- a/src/s3fs.cpp +++ b/src/s3fs.cpp @@ -3814,6 +3814,16 @@ static int my_fuse_opt_proc(void *data, const char *arg, int key, struct fuse_ar } if (strstr(arg, "url=") != 0) { host = strchr(arg, '=') + 1; + // strip the trailing '/', if any, off the end of the host + // string + size_t found, length; + found = host.find_last_of('/'); + length = host.length(); + while ( found == (length - 1) && length > 0 ) { + host.erase(found); + found = host.find_last_of('/'); + length = host.length(); + } return 0; } // debug option