Path: blob/main/ftp/curl/files/patch-src-tool_operate.c
16130 views
--- src/tool_operate.c.orig 2019-11-04 08:43:26 UTC1+++ src/tool_operate.c2@@ -992,20 +992,7 @@ static CURLcode single_transfer(struct G3DEBUGASSERT(!outs->filename);4}56- if(config->resume_from_current) {7- /* We're told to continue from where we are now. Get the size8- of the file as it is now and open it for append instead */9- struct_stat fileinfo;10- /* VMS -- Danger, the filesize is only valid for stream files */11- if(0 == stat(per->outfile, &fileinfo))12- /* set offset to current file size: */13- config->resume_from = fileinfo.st_size;14- else15- /* let offset be 0 */16- config->resume_from = 0;17- }18-19- if(config->resume_from) {20+ if(config->resume_from || config->resume_from_current) {21#ifdef __VMS22/* open file for output, forcing VMS output format into stream23mode which is needed for stat() call above to always work. */24@@ -1022,6 +1009,19 @@ static CURLcode single_transfer(struct G25}26outs->fopened = TRUE;27outs->stream = file;28+29+ if(config->resume_from_current) {30+ /* We're told to continue from where we are now. Get the size31+ of the file as it is now */32+ struct_stat fileinfo;33+ if(0 == fstat(fileno(outs->stream), &fileinfo))34+ /* set offset to current file size: */35+ config->resume_from = fileinfo.st_size;36+ else37+ /* let offset be 0 */38+ config->resume_from = 0;39+ }40+41outs->init = config->resume_from;42}43else {444546