fix: set stack size to 8 MB for windows and dup fd for gzdopen
This commit is contained in:
parent
6357032cd6
commit
2f9ab38fd0
|
@ -176,6 +176,14 @@ IF(APPLE)
|
||||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
IF(TD_WINDOWS)
|
||||||
|
IF(MSVC)
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:8388608")
|
||||||
|
ELSEIF(MINGW)
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--stack,8388608")
|
||||||
|
ENDIF()
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
MESSAGE(STATUS "Platform arch:" ${PLATFORM_ARCH_STR})
|
MESSAGE(STATUS "Platform arch:" ${PLATFORM_ARCH_STR})
|
||||||
|
|
||||||
set(TD_DEPS_DIR "x86")
|
set(TD_DEPS_DIR "x86")
|
||||||
|
|
|
@ -926,10 +926,16 @@ int32_t taosCompressFile(char *srcFileName, char *destFileName) {
|
||||||
goto cmp_end;
|
goto cmp_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
dstFp = gzdopen(pFile->fd, "wb6f");
|
// Both gzclose() and fclose() will close the associated fd, so they need to have different fds.
|
||||||
|
FileFd gzFd = dup(pFile->fd);
|
||||||
|
if (gzFd < 0) {
|
||||||
|
ret = -4;
|
||||||
|
goto cmp_end;
|
||||||
|
}
|
||||||
|
dstFp = gzdopen(gzFd, "wb6f");
|
||||||
if (dstFp == NULL) {
|
if (dstFp == NULL) {
|
||||||
ret = -3;
|
ret = -3;
|
||||||
taosCloseFile(&pFile);
|
close(gzFd);
|
||||||
goto cmp_end;
|
goto cmp_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue