Merge pull request #27392 from taosdata/fix/TD-31569/setDelFileOnWindows
Fix/td 31569/set del file on windows
This commit is contained in:
commit
ed9666595c
|
@ -1350,7 +1350,7 @@ static int32_t createSortMemFile(SSortHandle* pHandle) {
|
||||||
}
|
}
|
||||||
if (code == TSDB_CODE_SUCCESS) {
|
if (code == TSDB_CODE_SUCCESS) {
|
||||||
taosGetTmpfilePath(tsTempDir, "sort-ext-mem", pMemFile->memFilePath);
|
taosGetTmpfilePath(tsTempDir, "sort-ext-mem", pMemFile->memFilePath);
|
||||||
pMemFile->pTdFile = taosOpenCFile(pMemFile->memFilePath, "w+");
|
pMemFile->pTdFile = taosOpenCFile(pMemFile->memFilePath, "w+b");
|
||||||
if (pMemFile->pTdFile == NULL) {
|
if (pMemFile->pTdFile == NULL) {
|
||||||
code = terrno = TAOS_SYSTEM_ERROR(errno);
|
code = terrno = TAOS_SYSTEM_ERROR(errno);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue