diff options
author | Daniel Stenberg <daniel@haxx.se> | 2000-12-12 08:48:39 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2000-12-12 08:48:39 +0000 |
commit | 5d44f00201d461ebabf3982a35c7adb8474429f7 (patch) | |
tree | 7ea21a0a62545b95b48671079577370d27499ee2 | |
parent | cddeb939ede4fac90a1a0833f11c13a401f5d240 (diff) |
Francois Petitjean's solaris core dump fix
-rw-r--r-- | src/main.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/main.c b/src/main.c index a7d474cac..e1234f7fd 100644 --- a/src/main.c +++ b/src/main.c @@ -1486,13 +1486,14 @@ operate(struct Configurable *config, int argc, char *argv[]) if(!config->outfile && config->remotefile) { /* Find and get the remote file name */ - config->outfile=strstr(url, "://"); - if(config->outfile) - config->outfile+=3; + char * pc =strstr(url, "://"); + if(pc) + pc+=3; else - config->outfile=url; - config->outfile = strdup(strrchr(config->outfile, '/')); - if(!config->outfile || !strlen(++config->outfile)) { + pc=url; + pc = strrchr(pc, '/'); + config->outfile = (char *) NULL == pc ? NULL : strdup(pc+1) ; + if(!config->outfile || !strlen(config->outfile)) { helpf("Remote file name has no length!\n"); return CURLE_WRITE_ERROR; } |