aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarc Hoersken <info@marc-hoersken.de>2020-03-07 10:59:27 +0100
committerMarc Hoersken <info@marc-hoersken.de>2020-03-07 10:59:27 +0100
commita39e5bfb9688f3eaab14272ba81ba78f7794f0d3 (patch)
treefe8725c27d14ccdc53be5f6762e646ed0dbf87e0 /src
parent2f4c36357beabfa57383933b42a5563b7163c6ee (diff)
seek: fix fallback for missing ftruncate on Windows
This fixes test 198 on versions of MinGW-w64 without ftruncate Reviewed-By: Daniel Stenberg Reviewed-By: Marcel Raad Closes #5055
Diffstat (limited to 'src')
-rw-r--r--src/tool_cb_see.c4
-rw-r--r--src/tool_cb_see.h9
2 files changed, 6 insertions, 7 deletions
diff --git a/src/tool_cb_see.c b/src/tool_cb_see.c
index 99be273d1..a0ddc00ed 100644
--- a/src/tool_cb_see.c
+++ b/src/tool_cb_see.c
@@ -88,7 +88,7 @@ int tool_seek_cb(void *userdata, curl_off_t offset, int whence)
return CURL_SEEKFUNC_OK;
}
-#if defined(WIN32) && !defined(__MINGW64__)
+#ifdef USE_TOOL_FTRUNCATE
#ifdef __BORLANDC__
/* 64-bit lseek-like function unavailable */
@@ -129,4 +129,4 @@ int tool_ftruncate64(int fd, curl_off_t where)
return 0;
}
-#endif /* WIN32 && ! __MINGW64__ */
+#endif /* USE_TOOL_FTRUNCATE */
diff --git a/src/tool_cb_see.h b/src/tool_cb_see.h
index fed8bbf8d..18ab02be4 100644
--- a/src/tool_cb_see.h
+++ b/src/tool_cb_see.h
@@ -23,18 +23,17 @@
***************************************************************************/
#include "tool_setup.h"
-#if defined(WIN32) && !defined(__MINGW64__)
+#if defined(WIN32) && !defined(HAVE_FTRUNCATE)
int tool_ftruncate64(int fd, curl_off_t where);
#undef ftruncate
#define ftruncate(fd,where) tool_ftruncate64(fd,where)
-#ifndef HAVE_FTRUNCATE
-# define HAVE_FTRUNCATE 1
-#endif
+#define HAVE_FTRUNCATE 1
+#define USE_TOOL_FTRUNCATE 1
-#endif /* WIN32 && ! __MINGW64__ */
+#endif /* WIN32 && ! HAVE_FTRUNCATE */
/*
** callback for CURLOPT_SEEKFUNCTION