fix: set auto del

This commit is contained in:
xsren 2024-08-22 09:54:12 +08:00
parent 852d8fccd8
commit 378dadf7c4
1 changed files with 8 additions and 1 deletions

View File

@ -1633,7 +1633,14 @@ int taosCloseCFile(FILE *f) { return fclose(f); }
int taosSetAutoDelFile(char *path) { int taosSetAutoDelFile(char *path) {
#ifdef WINDOWS #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 #else
if (-1 == unlink(path)) { if (-1 == unlink(path)) {
terrno = TAOS_SYSTEM_ERROR(errno); terrno = TAOS_SYSTEM_ERROR(errno);