Merge pull request #3100 from taosdata/feature/2.0tsdb
fix part of coverity scan problem
This commit is contained in:
commit
f8799745d0
|
@ -132,7 +132,7 @@ int tsdbOpenFileH(STsdbRepo *pRepo) {
|
||||||
char *fname = malloc(strlen(tDataDir) + strlen(dp->d_name) + 2);
|
char *fname = malloc(strlen(tDataDir) + strlen(dp->d_name) + 2);
|
||||||
if (fname == NULL) goto _err;
|
if (fname == NULL) goto _err;
|
||||||
sprintf(fname, "%s/%s", tDataDir, dp->d_name);
|
sprintf(fname, "%s/%s", tDataDir, dp->d_name);
|
||||||
remove(fname);
|
(void)remove(fname);
|
||||||
free(fname);
|
free(fname);
|
||||||
} else if (code == REG_NOMATCH) {
|
} else if (code == REG_NOMATCH) {
|
||||||
tsdbError("vgId:%d invalid file %s exists, ignore it", REPO_ID(pRepo), dp->d_name);
|
tsdbError("vgId:%d invalid file %s exists, ignore it", REPO_ID(pRepo), dp->d_name);
|
||||||
|
@ -447,6 +447,8 @@ void tsdbGetFileInfoImpl(char *fname, uint32_t *magic, int32_t *size) {
|
||||||
*magic = info.magic;
|
*magic = info.magic;
|
||||||
*size = (int32_t)offset;
|
*size = (int32_t)offset;
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
_err:
|
_err:
|
||||||
if (fd >= 0) close(fd);
|
if (fd >= 0) close(fd);
|
||||||
*magic = TSDB_FILE_INIT_MAGIC;
|
*magic = TSDB_FILE_INIT_MAGIC;
|
||||||
|
|
|
@ -683,11 +683,11 @@ static int tsdbCommitToFile(STsdbRepo *pRepo, int fid, SCommitIter *iters, SRWHe
|
||||||
|
|
||||||
pthread_rwlock_wrlock(&(pFileH->fhlock));
|
pthread_rwlock_wrlock(&(pFileH->fhlock));
|
||||||
|
|
||||||
rename(helperNewHeadF(pHelper)->fname, helperHeadF(pHelper)->fname);
|
(void)rename(helperNewHeadF(pHelper)->fname, helperHeadF(pHelper)->fname);
|
||||||
pGroup->files[TSDB_FILE_TYPE_HEAD].info = helperNewHeadF(pHelper)->info;
|
pGroup->files[TSDB_FILE_TYPE_HEAD].info = helperNewHeadF(pHelper)->info;
|
||||||
|
|
||||||
if (newLast) {
|
if (newLast) {
|
||||||
rename(helperNewLastF(pHelper)->fname, helperLastF(pHelper)->fname);
|
(void)rename(helperNewLastF(pHelper)->fname, helperLastF(pHelper)->fname);
|
||||||
pGroup->files[TSDB_FILE_TYPE_LAST].info = helperNewLastF(pHelper)->info;
|
pGroup->files[TSDB_FILE_TYPE_LAST].info = helperNewLastF(pHelper)->info;
|
||||||
} else {
|
} else {
|
||||||
pGroup->files[TSDB_FILE_TYPE_LAST].info = helperLastF(pHelper)->info;
|
pGroup->files[TSDB_FILE_TYPE_LAST].info = helperLastF(pHelper)->info;
|
||||||
|
|
|
@ -351,6 +351,8 @@ void tsdbGetStoreInfo(char *fname, uint32_t *magic, int32_t *size) {
|
||||||
*magic = info.magic;
|
*magic = info.magic;
|
||||||
*size = (int32_t)offset;
|
*size = (int32_t)offset;
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
_err:
|
_err:
|
||||||
if (fd >= 0) close(fd);
|
if (fd >= 0) close(fd);
|
||||||
*magic = TD_KVSTORE_INIT_MAGIC;
|
*magic = TD_KVSTORE_INIT_MAGIC;
|
||||||
|
|
Loading…
Reference in New Issue