diff --git a/source/dnode/mnode/impl/src/mndStreamTrans.c b/source/dnode/mnode/impl/src/mndStreamTrans.c index c16016cf13..7171d44da4 100644 --- a/source/dnode/mnode/impl/src/mndStreamTrans.c +++ b/source/dnode/mnode/impl/src/mndStreamTrans.c @@ -324,7 +324,7 @@ void killAllCheckpointTrans(SMnode *pMnode, SVgroupChangeInfo *pChangeInfo) { size_t len = 0; void *pKey = taosHashGetKey(pDb, &len); - stpncpy(p, pKey, 127); + tstrncpy(p, pKey, 128); int32_t code = doKillCheckpointTrans(pMnode, pKey, len); if (code) { diff --git a/source/os/src/osString.c b/source/os/src/osString.c index 28ea46ba1a..d265ed510a 100644 --- a/source/os/src/osString.c +++ b/source/os/src/osString.c @@ -87,18 +87,18 @@ char *stpncpy(char *dest, const char *src, int n) { if (size == n) return dest; return memset(dest, '\0', n - size); } -#endif - +#else char *taosStrndup(const char *s, int size) { if (s == NULL) { return NULL; } - char* p = strndup(s, size); + char *p = strndup(s, size); if (NULL == p) { terrno = TSDB_CODE_OUT_OF_MEMORY; } return p; } +#endif int32_t taosStr2int64(const char *str, int64_t *val) { if (str == NULL || val == NULL) {