aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2014-10-09 16:42:17 +0200
committerDaniel Stenberg <daniel@haxx.se>2014-10-09 16:42:17 +0200
commitb546c7c926c8d713719a4ffd469a25cfda1c918e (patch)
treed20db107abe7da0561c382ee3ce9b721fd00e667 /src
parent199b3e46f9b9b62238388bb49bdd83303d26437f (diff)
get_url_file_name: make no slash equal empty string
Diffstat (limited to 'src')
-rw-r--r--src/tool_operhlp.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/tool_operhlp.c b/src/tool_operhlp.c
index 4a13cf186..7a6ed2015 100644
--- a/src/tool_operhlp.c
+++ b/src/tool_operhlp.c
@@ -140,13 +140,16 @@ CURLcode get_url_file_name(char **filename, const char *url)
pc = url;
pc = strrchr(pc, '/');
- if(pc) {
+ if(pc)
/* duplicate the string beyond the slash */
pc++;
- *filename = strdup(pc);
- if(!*filename)
- return CURLE_OUT_OF_MEMORY;
- }
+ else
+ /* no slash => empty string */
+ pc = "";
+
+ *filename = strdup(pc);
+ if(!*filename)
+ return CURLE_OUT_OF_MEMORY;
/* in case we built debug enabled, we allow an environment variable
* named CURL_TESTDIR to prefix the given file name to put it into a