aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2005-03-05 00:54:16 +0000
committerDan Fandrich <dan@coneharvesters.com>2005-03-05 00:54:16 +0000
commit42ac24448ca019564d03a43d9e6b465c0e8248c0 (patch)
tree1cb6d9649e03bb8c6db014b2097a2bbb427c9ae9
parent31891b55a4cfb35b49093edd611fa01ed9f4df2a (diff)
Better cope with a failed or unavailable ftruncate().
Added HAVE_FTRUNCATE to all the static config-*.h files on the assumption that all those systems provide it.
-rw-r--r--packages/vms/config-vms.h3
-rw-r--r--src/Makefile.netware1
-rw-r--r--src/config-amigaos.h1
-rw-r--r--src/config-mac.h1
-rw-r--r--src/config-riscos.h3
-rw-r--r--src/config-vms.h3
-rw-r--r--src/config-win32.h3
-rw-r--r--src/main.c4
8 files changed, 18 insertions, 1 deletions
diff --git a/packages/vms/config-vms.h b/packages/vms/config-vms.h
index 45ee1b18d..275f0f12e 100644
--- a/packages/vms/config-vms.h
+++ b/packages/vms/config-vms.h
@@ -96,6 +96,9 @@
/* Define if you have the strstr function. */
#define HAVE_STRSTR 1
+/* Define if you have the ftruncate function. */
+#define HAVE_FTRUNCATE 1
+
/* Define if you have the uname function. */
#define HAVE_UNAME 1
diff --git a/src/Makefile.netware b/src/Makefile.netware
index d3d14fdfc..c5f73c704 100644
--- a/src/Makefile.netware
+++ b/src/Makefile.netware
@@ -280,6 +280,7 @@ config.h: Makefile.netware
@echo $(DL)#define HAVE_ERR_H 1$(DL) >> $@
@echo $(DL)#define HAVE_FCNTL_H 1$(DL) >> $@
@echo $(DL)#define HAVE_FIONBIO 1$(DL) >> $@
+ @echo $(DL)#define HAVE_FTRUNCATE 1$(DL) >> $@
@echo $(DL)#define HAVE_GETHOSTBYADDR 1$(DL) >> $@
@echo $(DL)#define HAVE_GETTIMEOFDAY 1$(DL) >> $@
@echo $(DL)#define HAVE_INET_ADDR 1$(DL) >> $@
diff --git a/src/config-amigaos.h b/src/config-amigaos.h
index 2d66e37e3..0f904a30f 100644
--- a/src/config-amigaos.h
+++ b/src/config-amigaos.h
@@ -18,6 +18,7 @@
#define HAVE_TIME_H 1
#define TIME_WITH_SYS_TIME 1
#define HAVE_TERMIOS_H 1
+#define HAVE_FTRUNCATE 1
#define HAVE_PWD_H 1
diff --git a/src/config-mac.h b/src/config-mac.h
index 36505c94c..e1806d5c6 100644
--- a/src/config-mac.h
+++ b/src/config-mac.h
@@ -8,6 +8,7 @@
#define HAVE_SETVBUF 1
#define HAVE_UTIME 1
+#define HAVE_FTRUNCATE 1
#define main(x,y) curl_main(x,y)
diff --git a/src/config-riscos.h b/src/config-riscos.h
index 166021421..321336479 100644
--- a/src/config-riscos.h
+++ b/src/config-riscos.h
@@ -89,6 +89,9 @@
/* Define if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H
+/* Define if you have the `ftruncate' function. */
+#define HAVE_FTRUNCATE
+
/* Define if getaddrinfo exists and works */
#define HAVE_GETADDRINFO
diff --git a/src/config-vms.h b/src/config-vms.h
index 79f1ba7b7..3df6535d5 100644
--- a/src/config-vms.h
+++ b/src/config-vms.h
@@ -11,6 +11,9 @@
/* Define if you have the <io.h> header file. */
#undef HAVE_IO_H
+/* Define if you have ftruncate() */
+#define HAVE_FTRUNCATE 1
+
/* Define if you have strdup() */
#define HAVE_STRDUP 1
diff --git a/src/config-win32.h b/src/config-win32.h
index a7c0d1682..c07c349e5 100644
--- a/src/config-win32.h
+++ b/src/config-win32.h
@@ -14,6 +14,9 @@
/* Define if you have the <limits.h> header file */
#define HAVE_LIMITS_H 1
+/* Define if you have the ftruncate function. */
+#define HAVE_FTRUNCATE 1
+
/* Define if you have the strdup function. */
#define HAVE_STRDUP 1
diff --git a/src/main.c b/src/main.c
index b37d1dae0..43e9c4939 100644
--- a/src/main.c
+++ b/src/main.c
@@ -3771,10 +3771,12 @@ operate(struct Configurable *config, int argc, char *argv[])
" bytes\n", outs.bytes);
fflush(outs.stream);
/* truncate file at the position where we started appending */
+#ifdef HAVE_FTRUNCATE
ftruncate( fileno(outs.stream), outs.init);
+#endif
/* now seek to the end of the file, the position where we
just truncated the file */
- fseek(outs.stream, 0, SEEK_END);
+ fseek(outs.stream, outs.init, SEEK_SET);
outs.bytes = 0; /* clear for next round */
}
continue;