]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
*** empty log message ***
authorGisle Vanem <gvanem@broadpark.no>
Thu, 28 Oct 2004 13:13:29 +0000 (13:13 +0000)
committerGisle Vanem <gvanem@broadpark.no>
Thu, 28 Oct 2004 13:13:29 +0000 (13:13 +0000)
src/main.c

index 48649c58a90433f3a2bd9269f1f43db8459c4a5b..1a1d15ed4b05408866a68088203612815d0ec77d 100644 (file)
@@ -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