diff --git a/include/os/osFile.h b/include/os/osFile.h index e409936468..503535a454 100644 --- a/include/os/osFile.h +++ b/include/os/osFile.h @@ -64,6 +64,8 @@ typedef struct TdFile *TdFilePtr; #define TD_FILE_EXCL 0x0080 #define TD_FILE_STREAM 0x0100 // Only support taosFprintfFile, taosGetLineFile, taosEOFFile #define TD_FILE_WRITE_THROUGH 0x0200 +#define TD_FILE_CLOEXEC 0x0400 + TdFilePtr taosOpenFile(const char *path, int32_t tdFileOptions); TdFilePtr taosCreateFile(const char *path, int32_t tdFileOptions); diff --git a/source/common/src/rsync.c b/source/common/src/rsync.c index ffab85761e..6f6a021b3b 100644 --- a/source/common/src/rsync.c +++ b/source/common/src/rsync.c @@ -151,6 +151,8 @@ void startRsync(){ uDebug("[rsync] start server successful"); } +} + int uploadRsync(char* id, char* path){ #ifdef WINDOWS char pathTransform[PATH_MAX] = {0}; diff --git a/source/dnode/mgmt/node_util/src/dmFile.c b/source/dnode/mgmt/node_util/src/dmFile.c index 03c6734e0c..5cbeeebc14 100644 --- a/source/dnode/mgmt/node_util/src/dmFile.c +++ b/source/dnode/mgmt/node_util/src/dmFile.c @@ -149,7 +149,7 @@ TdFilePtr dmCheckRunning(const char *dataDir) { char filepath[PATH_MAX] = {0}; snprintf(filepath, sizeof(filepath), "%s%s.running", dataDir, TD_DIRSEP); - TdFilePtr pFile = taosOpenFile(filepath, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC); + TdFilePtr pFile = taosOpenFile(filepath, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC | TD_FILE_CLOEXEC); if (pFile == NULL) { terrno = TAOS_SYSTEM_ERROR(errno); dError("failed to open file:%s since %s", filepath, terrstr()); diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 28832ffec8..5d4d2b7461 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1549,7 +1549,7 @@ static int32_t generateDeleteResultBlock(SStreamScanInfo* pInfo, SSDataBlock* pS for (int32_t i = 0; i < pSrcBlock->info.rows; i++) { uint64_t srcUid = srcUidData[i]; uint64_t groupId = srcGp[i]; - char* tbname[VARSTR_HEADER_SIZE + TSDB_TABLE_NAME_LEN] = {0}; + char tbname[VARSTR_HEADER_SIZE + TSDB_TABLE_NAME_LEN] = {0}; if (groupId == 0) { groupId = getGroupIdByData(pInfo, srcUid, srcStartTsCol[i], ver); } diff --git a/source/os/src/osFile.c b/source/os/src/osFile.c index cf3bce1ad4..15aca85fc2 100644 --- a/source/os/src/osFile.c +++ b/source/os/src/osFile.c @@ -647,6 +647,8 @@ int taosOpenFileNotStream(const char *path, int32_t tdFileOptions) { access |= (tdFileOptions & TD_FILE_APPEND) ? O_APPEND : 0; access |= (tdFileOptions & TD_FILE_TEXT) ? O_TEXT : 0; access |= (tdFileOptions & TD_FILE_EXCL) ? O_EXCL : 0; + access |= (tdFileOptions & TD_FILE_CLOEXEC) ? O_CLOEXEC : 0; + int fd = open(path, access, S_IRWXU | S_IRWXG | S_IRWXO); return fd; }