summaryrefslogtreecommitdiff
path: root/ftp/curl/files/patch-src-tool_operate.c
diff options
context:
space:
mode:
authorSunpoet Po-Chuan Hsieh <sunpoet@FreeBSD.org>2012-03-03 08:05:19 +0000
committerSunpoet Po-Chuan Hsieh <sunpoet@FreeBSD.org>2012-03-03 08:05:19 +0000
commit49641faa1b4bdecd56c80cb88280143e0aac03af (patch)
treecff4d798c74c905e8887918e016391bc1e5ae12e /ftp/curl/files/patch-src-tool_operate.c
parent- Update to 1.006003 (diff)
- Update to 7.24.0
Changes: http://curl.haxx.se/changes.html
Notes
Notes: svn path=/head/; revision=292569
Diffstat (limited to 'ftp/curl/files/patch-src-tool_operate.c')
-rw-r--r--ftp/curl/files/patch-src-tool_operate.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/ftp/curl/files/patch-src-tool_operate.c b/ftp/curl/files/patch-src-tool_operate.c
new file mode 100644
index 000000000000..a168b8bcec40
--- /dev/null
+++ b/ftp/curl/files/patch-src-tool_operate.c
@@ -0,0 +1,48 @@
+--- src/tool_operate.c.orig 2012-01-23 23:31:30.000000000 +0800
++++ src/tool_operate.c 2012-02-26 17:40:00.117907281 +0800
+@@ -580,22 +580,10 @@
+ DEBUGASSERT(!outs.filename);
+ }
+
+- if(config->resume_from_current) {
+- /* We're told to continue from where we are now. Get the size
+- of the file as it is now and open it for append instead */
+- struct_stat fileinfo;
+- /* VMS -- Danger, the filesize is only valid for stream files */
+- if(0 == stat(outfile, &fileinfo))
+- /* set offset to current file size: */
+- config->resume_from = fileinfo.st_size;
+- else
+- /* let offset be 0 */
+- config->resume_from = 0;
+- }
+-
+- if(config->resume_from) {
++ if(config->resume_from || config->resume_from_current) {
+ /* open file for output: */
+- FILE *file = fopen(outfile, config->resume_from?"ab":"wb");
++ /* (always open for appending, it has no effect on new files) */
++ FILE *file = fopen(outfile, "ab");
+ if(!file) {
+ helpf(config->errors, "Can't open '%s'!\n", outfile);
+ res = CURLE_WRITE_ERROR;
+@@ -603,6 +591,19 @@
+ }
+ outs.fopened = TRUE;
+ outs.stream = file;
++
++ if(config->resume_from_current) {
++ /* We're told to continue from where we are now. Get the size
++ of the file as it is now */
++ struct_stat fileinfo;
++ if(0 == fstat(fileno(outs.stream), &fileinfo))
++ /* set offset to current file size: */
++ config->resume_from = fileinfo.st_size;
++ else
++ /* let offset be 0 */
++ config->resume_from = 0;
++ }
++
+ outs.init = config->resume_from;
+ }
+ else {