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] 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);