From 378dadf7c45012dcd625edde65894ec23a4fd37c Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Thu, 22 Aug 2024 09:54:12 +0800 Subject: [PATCH 1/2] fix: set auto del --- source/os/src/osFile.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/source/os/src/osFile.c b/source/os/src/osFile.c index 16ebe05520..c274c7fbab 100644 --- a/source/os/src/osFile.c +++ b/source/os/src/osFile.c @@ -1633,7 +1633,14 @@ int taosCloseCFile(FILE *f) { return fclose(f); } int taosSetAutoDelFile(char *path) { #ifdef WINDOWS - return SetFileAttributes(path, FILE_ATTRIBUTE_TEMPORARY); + bool succ = SetFileAttributes(path, FILE_ATTRIBUTE_TEMPORARY); + if (succ) { + return 0; + } else { + DWORD error = GetLastError(); + terrno = TAOS_SYSTEM_ERROR(error); + return terrno; + } #else if (-1 == unlink(path)) { terrno = TAOS_SYSTEM_ERROR(errno); From acdb14aefbeaebeab716c37e0d7b522007b2091b Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Thu, 22 Aug 2024 12:53:55 +0800 Subject: [PATCH 2/2] opeCFile with w+b mode --- source/libs/executor/src/tsort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/executor/src/tsort.c b/source/libs/executor/src/tsort.c index 5bd11489c9..6e23700d52 100644 --- a/source/libs/executor/src/tsort.c +++ b/source/libs/executor/src/tsort.c @@ -1350,7 +1350,7 @@ static int32_t createSortMemFile(SSortHandle* pHandle) { } if (code == TSDB_CODE_SUCCESS) { taosGetTmpfilePath(tsTempDir, "sort-ext-mem", pMemFile->memFilePath); - pMemFile->pTdFile = taosOpenCFile(pMemFile->memFilePath, "w+"); + pMemFile->pTdFile = taosOpenCFile(pMemFile->memFilePath, "w+b"); if (pMemFile->pTdFile == NULL) { code = terrno = TAOS_SYSTEM_ERROR(errno); }