From 0429d824553cdf31976edda85b413f522e558ec3 Mon Sep 17 00:00:00 2001 From: Seigo Tanimura Date: Fri, 19 Jan 2024 02:23:51 +0900 Subject: [PATCH] pal: Convert the strerror_s(3) return value to POSIX.1-2001 strerror_r(3). It is misleading that the return type of strerror_s(3) is errno_t, while its semantics is the int a la the Unix system calls. While I am here, fix the unintended tabs. Signed-off-by: Seigo Tanimura --- src/flb_pal.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/flb_pal.c b/src/flb_pal.c index 719d7a1f29e..35c33e17f68 100644 --- a/src/flb_pal.c +++ b/src/flb_pal.c @@ -60,10 +60,15 @@ int flb_strerror_r(int errnum, char *buf, size_t buflen) return ret; #else - return strerror_r(errnum, buf, buflen); + return strerror_r(errnum, buf, buflen); #endif #elif defined(FLB_HAVE_STRERROR_S) - return (int) strerror_s(buf, (rsize_t)buflen, (errno_t)errnum); + int ret; + + ret = (int) strerror_s(buf, (rsize_t)buflen, (errno_t)errnum); + if (0 != ret) { + ret = ERANGE; + } #endif } #endif