From 42a5f69dd1ffea3dcfc4bdea604c67debedf3bd0 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Tue, 31 Dec 2024 18:18:28 +0800 Subject: [PATCH] fix:[TD-32471]set error code to terrno if tmq_consumer_poll return NULL --- include/util/taoserror.h | 1 + source/client/src/clientRawBlockWrite.c | 2 +- source/util/src/terror.c | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/util/taoserror.h b/include/util/taoserror.h index d3d5599016..a45a017688 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -47,6 +47,7 @@ const char* terrstr(); char* taosGetErrMsgReturn(); char* taosGetErrMsg(); +void taosClearErrMsg(); int32_t* taosGetErrno(); int32_t* taosGetErrln(); int32_t taosGetErrSize(); diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index 178ab6b253..c200d38a56 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -2572,7 +2572,7 @@ int32_t tmq_write_raw(TAOS* taos, tmq_raw_data raw) { SET_ERROR_MSG("taos:%p or data:%p is NULL or raw_len <= 0", taos, raw.raw); return TSDB_CODE_INVALID_PARA; } - SET_ERROR_MSG(""); // clear global error message + taosClearErrMsg(); // clear global error message return writeRawImpl(taos, raw.raw, raw.raw_len, raw.raw_type); } diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 873733a64b..572a1b23fe 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -29,6 +29,7 @@ static threadlocal char tsErrMsgReturn[ERR_MSG_LEN] = {0}; int32_t* taosGetErrno() { return &tsErrno; } int32_t* taosGetErrln() { return &tsErrln; } char* taosGetErrMsg() { return tsErrMsgDetail; } +void taosClearErrMsg() { tsErrMsgDetail[0] = '\0'; } char* taosGetErrMsgReturn() { return tsErrMsgReturn; } #ifdef TAOS_ERROR_C