diff --git a/source/dnode/vnode/src/tsdb/tsdbFile.c b/source/dnode/vnode/src/tsdb/tsdbFile.c index 36fb2b11100d2ef29c31f99dc2e446d0d0d7f0af..5a00fa20a0d530189a41b048ad1a1b0e515248ef 100644 --- a/source/dnode/vnode/src/tsdb/tsdbFile.c +++ b/source/dnode/vnode/src/tsdb/tsdbFile.c @@ -356,7 +356,7 @@ int tsdbCreateDFile(STsdb *pRepo, SDFile *pDFile, bool updateHeader) { ASSERT(pDFile->info.size == 0 && pDFile->info.magic == TSDB_FILE_INIT_MAGIC); pDFile->pFile = taosOpenFile(TSDB_FILE_FULL_NAME(pDFile), TD_FILE_CTEATE | TD_FILE_WRITE | TD_FILE_TRUNC); - if (pDFile->pFile < 0) { + if (pDFile->pFile == NULL) { if (errno == ENOENT) { // Try to create directory recursively char *s = strdup(TSDB_FILE_REL_NAME(pDFile)); @@ -367,7 +367,7 @@ int tsdbCreateDFile(STsdb *pRepo, SDFile *pDFile, bool updateHeader) { tfree(s); pDFile->pFile = taosOpenFile(TSDB_FILE_FULL_NAME(pDFile), TD_FILE_CTEATE | TD_FILE_WRITE | TD_FILE_TRUNC); - if (pDFile->pFile < 0) { + if (pDFile->pFile == NULL) { terrno = TAOS_SYSTEM_ERROR(errno); return -1; } diff --git a/source/libs/index/src/index_fst_counting_writer.c b/source/libs/index/src/index_fst_counting_writer.c index 86aa257b48a4f5d85e29ed87f6d1125099a79ab8..78c7a8d1934ad30c88ca8ab2b7fffd97c266eb88 100644 --- a/source/libs/index/src/index_fst_counting_writer.c +++ b/source/libs/index/src/index_fst_counting_writer.c @@ -105,7 +105,7 @@ WriterCtx* writerCtxCreate(WriterType type, const char* path, bool readOnly, int #endif } memcpy(ctx->file.buf, path, strlen(path)); - if (ctx->file.pFile < 0) { + if (ctx->file.pFile == NULL) { indexError("failed to open file, error %d", errno); goto END; } diff --git a/source/libs/tdb/src/db/tdbEnv.c b/source/libs/tdb/src/db/tdbEnv.c index 2afce3082849e469f083b6c113e482b603c504ac..a415d6d60e500cae4389aaf79fdc18f60cae4349 100644 --- a/source/libs/tdb/src/db/tdbEnv.c +++ b/source/libs/tdb/src/db/tdbEnv.c @@ -140,7 +140,7 @@ static int tdbEnvDestroy(TENV *pEnv) { int tdbEnvBeginTxn(TENV *pEnv) { pEnv->jpFile = taosOpenFile(pEnv->jname, TD_FILE_CTEATE | TD_FILE_WRITE | TD_FILE_READ); - if (pEnv->jpFile < 0) { + if (pEnv->jpFile == NULL) { return -1; } diff --git a/source/libs/tdb/src/db/tdbPgFile.c b/source/libs/tdb/src/db/tdbPgFile.c index 48f8ed179229604459c94dc1d97c7364b2004c52..12f062ebf767b927172e91a7a86de4e3cae7d32e 100644 --- a/source/libs/tdb/src/db/tdbPgFile.c +++ b/source/libs/tdb/src/db/tdbPgFile.c @@ -95,7 +95,7 @@ int pgFileOpen(SPgFile **ppPgFile, const char *fname, TENV *pEnv) { int pgFileClose(SPgFile *pPgFile) { if (pPgFile) { - if (pPgFile->pFile >= 0) { + if (pPgFile->pFile != NULL) { taosCloseFile(&pPgFile->pFile); } diff --git a/source/libs/transport/test/rserver.c b/source/libs/transport/test/rserver.c index 794497500c52dc58d13eaf1715461ef18daaf568..5432a07649e88c4852b3c1081d5a3837adc23598 100644 --- a/source/libs/transport/test/rserver.c +++ b/source/libs/transport/test/rserver.c @@ -43,7 +43,7 @@ void processShellMsg() { for (int i = 0; i < numOfMsgs; ++i) { taosGetQitem(qall, (void **)&pRpcMsg); - if (pDataFile >= 0) { + if (pDataFile != NULL) { if (taosWriteFile(pDataFile, pRpcMsg->pCont, pRpcMsg->contLen) < 0) { tInfo("failed to write data file, reason:%s", strerror(errno)); } diff --git a/source/libs/wal/src/walSeek.c b/source/libs/wal/src/walSeek.c index 7aae9138c12bffba5a6c786aa9cde9375f23eaf8..6b3abcd0f98ca15209f1fbeacab35ff8d83f14e8 100644 --- a/source/libs/wal/src/walSeek.c +++ b/source/libs/wal/src/walSeek.c @@ -58,13 +58,13 @@ int walSetWrite(SWal* pWal) { char fnameStr[WAL_FILE_LEN]; walBuildIdxName(pWal, fileFirstVer, fnameStr); pIdxTFile = taosOpenFile(fnameStr, TD_FILE_CTEATE | TD_FILE_WRITE | TD_FILE_APPEND); - if (pIdxTFile < 0) { + if (pIdxTFile == NULL) { terrno = TAOS_SYSTEM_ERROR(errno); return -1; } walBuildLogName(pWal, fileFirstVer, fnameStr); pLogTFile = taosOpenFile(fnameStr, TD_FILE_CTEATE | TD_FILE_WRITE | TD_FILE_APPEND); - if (pLogTFile < 0) { + if (pLogTFile == NULL) { terrno = TAOS_SYSTEM_ERROR(errno); return -1; } @@ -104,14 +104,14 @@ int walChangeWrite(SWal* pWal, int64_t ver) { int64_t fileFirstVer = pFileInfo->firstVer; walBuildIdxName(pWal, fileFirstVer, fnameStr); pIdxTFile = taosOpenFile(fnameStr, TD_FILE_CTEATE | TD_FILE_WRITE | TD_FILE_APPEND); - if (pIdxTFile < 0) { + if (pIdxTFile == NULL) { terrno = TAOS_SYSTEM_ERROR(errno); pWal->pWriteIdxTFile = NULL; return -1; } walBuildLogName(pWal, fileFirstVer, fnameStr); pLogTFile = taosOpenFile(fnameStr, TD_FILE_CTEATE | TD_FILE_WRITE | TD_FILE_APPEND); - if (pLogTFile < 0) { + if (pLogTFile == NULL) { taosCloseFile(&pIdxTFile); terrno = TAOS_SYSTEM_ERROR(errno); pWal->pWriteLogTFile = NULL; diff --git a/source/libs/wal/src/walWrite.c b/source/libs/wal/src/walWrite.c index f9bb1682343105f806f471411e131dc88507737b..ba071340034bbae320e9940efbf5032d387614fd 100644 --- a/source/libs/wal/src/walWrite.c +++ b/source/libs/wal/src/walWrite.c @@ -89,7 +89,7 @@ int32_t walRollback(SWal *pWal, int64_t ver) { walBuildLogName(pWal, walGetCurFileFirstVer(pWal), fnameStr); TdFilePtr pLogTFile = taosOpenFile(fnameStr, TD_FILE_WRITE | TD_FILE_READ); - if (pLogTFile < 0) { + if (pLogTFile == NULL) { // TODO pthread_mutex_unlock(&pWal->mutex); return -1; @@ -221,13 +221,13 @@ int walRoll(SWal *pWal) { char fnameStr[WAL_FILE_LEN]; walBuildIdxName(pWal, newFileFirstVersion, fnameStr); pIdxTFile = taosOpenFile(fnameStr, TD_FILE_CTEATE | TD_FILE_WRITE | TD_FILE_APPEND); - if (pIdxTFile < 0) { + if (pIdxTFile == NULL) { terrno = TAOS_SYSTEM_ERROR(errno); return -1; } walBuildLogName(pWal, newFileFirstVersion, fnameStr); pLogTFile = taosOpenFile(fnameStr, TD_FILE_CTEATE | TD_FILE_WRITE | TD_FILE_APPEND); - if (pLogTFile < 0) { + if (pLogTFile == NULL) { terrno = TAOS_SYSTEM_ERROR(errno); return -1; } diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index 52593741b4fb55c91fcce2231b6a5bf23160ae49..567885b0f4f31081486631e64bfe35bd6cbe5803 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -416,7 +416,7 @@ void taosPrintLog(const char *flags, int32_t dflag, const char *format, ...) { buffer[len++] = '\n'; buffer[len] = 0; - if ((dflag & DEBUG_FILE) && tsLogObj.logHandle && tsLogObj.logHandle->pFile >= 0) { + if ((dflag & DEBUG_FILE) && tsLogObj.logHandle && tsLogObj.logHandle->pFile != NULL) { if (tsAsyncLog) { taosPushLogBuffer(tsLogObj.logHandle, buffer, len); } else { @@ -483,7 +483,7 @@ void taosPrintLongString(const char *flags, int32_t dflag, const char *format, . buffer[len++] = '\n'; buffer[len] = 0; - if ((dflag & DEBUG_FILE) && tsLogObj.logHandle && tsLogObj.logHandle->pFile >= 0) { + if ((dflag & DEBUG_FILE) && tsLogObj.logHandle && tsLogObj.logHandle->pFile != NULL) { if (tsAsyncLog) { taosPushLogBuffer(tsLogObj.logHandle, buffer, len); } else {