提交 0b6d1171 编写于 作者: C Cary Xu

fix: add TD_PATH_MAX to support multi-platform

上级 d42214e9
...@@ -244,8 +244,8 @@ void syslog(int unused, const char *format, ...); ...@@ -244,8 +244,8 @@ void syslog(int unused, const char *format, ...);
#define TD_CHARSET_LEN 64 #define TD_CHARSET_LEN 64
#define TD_TIMEZONE_LEN 96 #define TD_TIMEZONE_LEN 96
#if defined(WINDOWS) #ifdef WINDOWS
#define TD_PATH_MAX _MAX_PATH #define TD_PATH_MAX 260
#elif defined(PATH_MAX) #elif defined(PATH_MAX)
#define TD_PATH_MAX PATH_MAX #define TD_PATH_MAX PATH_MAX
#elif defined(_XOPEN_PATH_MAX) #elif defined(_XOPEN_PATH_MAX)
......
...@@ -6,6 +6,7 @@ target_link_libraries( ...@@ -6,6 +6,7 @@ target_link_libraries(
) )
add_test( add_test(
NAME dbTest NAME dbTest
COMMAND dbTest COMMAND dbTest
) )
...@@ -38,7 +38,7 @@ int tsdbOpen(SVnode *pVnode, STsdb **ppTsdb, const char *dir, STsdbKeepCfg *pKee ...@@ -38,7 +38,7 @@ int tsdbOpen(SVnode *pVnode, STsdb **ppTsdb, const char *dir, STsdbKeepCfg *pKee
int slen = 0; int slen = 0;
*ppTsdb = NULL; *ppTsdb = NULL;
slen = TD_PATH_MAX; slen = 260;
// create handle // create handle
pTsdb = (STsdb *)taosMemoryCalloc(1, sizeof(*pTsdb) + slen); pTsdb = (STsdb *)taosMemoryCalloc(1, sizeof(*pTsdb) + slen);
...@@ -48,7 +48,7 @@ int tsdbOpen(SVnode *pVnode, STsdb **ppTsdb, const char *dir, STsdbKeepCfg *pKee ...@@ -48,7 +48,7 @@ int tsdbOpen(SVnode *pVnode, STsdb **ppTsdb, const char *dir, STsdbKeepCfg *pKee
} }
pTsdb->path = (char *)&pTsdb[1]; pTsdb->path = (char *)&pTsdb[1];
snprintf(pTsdb->path, TD_PATH_MAX, "%s%s%s", pVnode->path, TD_DIRSEP, dir); snprintf(pTsdb->path, 260, "%s%s%s", pVnode->path, TD_DIRSEP, dir);
taosRealPath(pTsdb->path, NULL, slen); taosRealPath(pTsdb->path, NULL, slen);
pTsdb->pVnode = pVnode; pTsdb->pVnode = pVnode;
taosThreadRwlockInit(&pTsdb->rwLock, NULL); taosThreadRwlockInit(&pTsdb->rwLock, NULL);
......
...@@ -9,6 +9,6 @@ target_link_libraries( ...@@ -9,6 +9,6 @@ target_link_libraries(
) )
add_test( add_test(
NAME tfs_test NAME tfs_test
COMMAND tfs_test COMMAND tfs_test
) )
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册