Skip to content

Commit a39e5bf

Browse files
committed
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
1 parent 2f4c363 commit a39e5bf

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

appveyor.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ environment:
8181
HTTP_ONLY: OFF
8282
TESTING: ON
8383
SHARED: OFF
84-
DISABLED_TESTS: "!198 !1139"
84+
DISABLED_TESTS: "!1139"
8585
COMPILER_PATH: "C:\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin"
8686
MSYS2_ARG_CONV_EXCL: "/*"
8787
BUILD_OPT: -k

src/tool_cb_see.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ int tool_seek_cb(void *userdata, curl_off_t offset, int whence)
8888
return CURL_SEEKFUNC_OK;
8989
}
9090

91-
#if defined(WIN32) && !defined(__MINGW64__)
91+
#ifdef USE_TOOL_FTRUNCATE
9292

9393
#ifdef __BORLANDC__
9494
/* 64-bit lseek-like function unavailable */
@@ -129,4 +129,4 @@ int tool_ftruncate64(int fd, curl_off_t where)
129129
return 0;
130130
}
131131

132-
#endif /* WIN32 && ! __MINGW64__ */
132+
#endif /* USE_TOOL_FTRUNCATE */

src/tool_cb_see.h

+4-5
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,17 @@
2323
***************************************************************************/
2424
#include "tool_setup.h"
2525

26-
#if defined(WIN32) && !defined(__MINGW64__)
26+
#if defined(WIN32) && !defined(HAVE_FTRUNCATE)
2727

2828
int tool_ftruncate64(int fd, curl_off_t where);
2929

3030
#undef ftruncate
3131
#define ftruncate(fd,where) tool_ftruncate64(fd,where)
3232

33-
#ifndef HAVE_FTRUNCATE
34-
# define HAVE_FTRUNCATE 1
35-
#endif
33+
#define HAVE_FTRUNCATE 1
34+
#define USE_TOOL_FTRUNCATE 1
3635

37-
#endif /* WIN32 && ! __MINGW64__ */
36+
#endif /* WIN32 && ! HAVE_FTRUNCATE */
3837

3938
/*
4039
** callback for CURLOPT_SEEKFUNCTION

0 commit comments

Comments
 (0)