From 1c90e272c302a8fd9f079f3d690f6f0e8b896630 Mon Sep 17 00:00:00 2001 From: slzhou Date: Tue, 1 Nov 2022 15:00:13 +0800 Subject: [PATCH] fix: uv_get_osenv set length only when no buf --- source/libs/function/src/tudf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/libs/function/src/tudf.c b/source/libs/function/src/tudf.c index d86bf15d10..85b14d6017 100644 --- a/source/libs/function/src/tudf.c +++ b/source/libs/function/src/tudf.c @@ -124,7 +124,10 @@ static int32_t udfSpawnUdfd(SUdfdData *pData) { char pathTaosdLdLib[512] = {0}; size_t taosdLdLibPathLen = sizeof(pathTaosdLdLib); - uv_os_getenv("LD_LIBRARY_PATH", pathTaosdLdLib, &taosdLdLibPathLen); + int ret = uv_os_getenv("LD_LIBRARY_PATH", pathTaosdLdLib, &taosdLdLibPathLen); + if (ret != UV_ENOBUFS) { + taosdLdLibPathLen = strlen(pathTaosdLdLib); + } char udfdPathLdLib[1024] = {0}; size_t udfdLdLibPathLen = strlen(tsUdfdLdLibPath);