fix: add TD_PATH_MAX to support multi-platform

This commit is contained in:
Cary Xu 2022-11-01 11:44:17 +08:00
parent d42214e94a
commit 0b6d117121
4 changed files with 9 additions and 8 deletions

View File

@ -244,8 +244,8 @@ void syslog(int unused, const char *format, ...);
#define TD_CHARSET_LEN 64
#define TD_TIMEZONE_LEN 96
#if defined(WINDOWS)
#define TD_PATH_MAX _MAX_PATH
#ifdef WINDOWS
#define TD_PATH_MAX 260
#elif defined(PATH_MAX)
#define TD_PATH_MAX PATH_MAX
#elif defined(_XOPEN_PATH_MAX)

View File

@ -6,6 +6,7 @@ target_link_libraries(
)
add_test(
NAME dbTest
COMMAND dbTest
NAME dbTest
COMMAND dbTest
)

View File

@ -38,7 +38,7 @@ int tsdbOpen(SVnode *pVnode, STsdb **ppTsdb, const char *dir, STsdbKeepCfg *pKee
int slen = 0;
*ppTsdb = NULL;
slen = TD_PATH_MAX;
slen = 260;
// create handle
pTsdb = (STsdb *)taosMemoryCalloc(1, sizeof(*pTsdb) + slen);
@ -48,7 +48,7 @@ int tsdbOpen(SVnode *pVnode, STsdb **ppTsdb, const char *dir, STsdbKeepCfg *pKee
}
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);
pTsdb->pVnode = pVnode;
taosThreadRwlockInit(&pTsdb->rwLock, NULL);

View File

@ -9,6 +9,6 @@ target_link_libraries(
)
add_test(
NAME tfs_test
COMMAND tfs_test
NAME tfs_test
COMMAND tfs_test
)