aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorGisle Vanem <gvanem@broadpark.no>2004-10-28 13:13:29 +0000
committerGisle Vanem <gvanem@broadpark.no>2004-10-28 13:13:29 +0000
commit629bba6b352768e0e39e4f18d53e7c1228e2222b (patch)
tree1cd8830a1b52539e5c1ccd445780a2cdff236317 /src/main.c
parentf6f2a9e4bef9efa3605a8348df5093631d3d3a9b (diff)
*** empty log message ***
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 48649c58a..1a1d15ed4 100644
--- a/src/main.c
+++ b/src/main.c
@@ -215,6 +215,28 @@ char *strdup(char *str)
#include "curlmsg_vms.h"
#endif
+#if !defined(HAVE_FTRUNCATE) && defined(WIN32)
+/*
+ * Truncate a file handle at a 64-bit position 'where'
+ */
+static int ftruncate (int fd, curl_off_t where)
+{
+ curl_off_t curr;
+ int rc = 0;
+
+ if ((curr = _lseeki64(fd, 0, SEEK_CUR)) < 0)
+ return -1;
+
+ if (_lseeki64(fd, where, SEEK_SET) < 0)
+ return -1;
+
+ if (_write(fd, curr, SEEK_SET) < 0)
+ rc = -1;
+ _lseeki64(fd, curr, SEEK_SET);
+ return rc;
+}
+#endif
+
/*
* This is the main global constructor for the app. Call this before
* _any_ libcurl usage. If this fails, *NO* libcurl functions may be