From cd12ed33a2ee595ddece72a4c0cf5c8f0c56ba1e Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Tue, 1 Nov 2022 17:09:56 +0800 Subject: [PATCH] enh: code optimization for tsdb path --- source/dnode/vnode/src/tsdb/tsdbOpen.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbOpen.c b/source/dnode/vnode/src/tsdb/tsdbOpen.c index c5ab751c17..ffeaea0ce9 100644 --- a/source/dnode/vnode/src/tsdb/tsdbOpen.c +++ b/source/dnode/vnode/src/tsdb/tsdbOpen.c @@ -38,14 +38,14 @@ int tsdbOpen(SVnode *pVnode, STsdb **ppTsdb, const char *dir, STsdbKeepCfg *pKee int slen = 0; *ppTsdb = NULL; - slen = TD_PATH_MAX; //strlen(pVnode->path) + strlen(dir) + 3; - - // if (slen > TD_PATH_MAX) { - // terrno = TSDB_CODE_OUT_OF_RANGE; - // tsdbError("vgId:%d, tsdb open failed since %s, path: %s%s%s", TD_VID(pVnode), terrstr(), pVnode->path, TD_DIRSEP, - // dir); - // return -1; - // } + slen = strlen(pVnode->path) + strlen(dir) + 3; + + if (slen > TD_PATH_MAX) { + terrno = TSDB_CODE_OUT_OF_RANGE; + tsdbError("vgId:%d, tsdb open failed since %s, path: %s%s%s", TD_VID(pVnode), terrstr(), pVnode->path, TD_DIRSEP, + dir); + return -1; + } // create handle pTsdb = (STsdb *)taosMemoryCalloc(1, sizeof(*pTsdb) + slen); -- GitLab