Francois Petitjean's solaris core dump fix

This commit is contained in:
Daniel Stenberg 2000-12-12 08:48:39 +00:00
parent cddeb939ed
commit 5d44f00201
1 changed files with 7 additions and 6 deletions

View File

@ -1486,13 +1486,14 @@ operate(struct Configurable *config, int argc, char *argv[])
if(!config->outfile && config->remotefile) { if(!config->outfile && config->remotefile) {
/* Find and get the remote file name */ /* Find and get the remote file name */
config->outfile=strstr(url, "://"); char * pc =strstr(url, "://");
if(config->outfile) if(pc)
config->outfile+=3; pc+=3;
else else
config->outfile=url; pc=url;
config->outfile = strdup(strrchr(config->outfile, '/')); pc = strrchr(pc, '/');
if(!config->outfile || !strlen(++config->outfile)) { config->outfile = (char *) NULL == pc ? NULL : strdup(pc+1) ;
if(!config->outfile || !strlen(config->outfile)) {
helpf("Remote file name has no length!\n"); helpf("Remote file name has no length!\n");
return CURLE_WRITE_ERROR; return CURLE_WRITE_ERROR;
} }