Skip to content

Commit

Permalink
pal: Convert the strerror_s(3) return value to POSIX.1-2001 strerror_…
Browse files Browse the repository at this point in the history
…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 <[email protected]>
  • Loading branch information
altimeter-130ft committed Jan 18, 2024
1 parent cec87d7 commit 0429d82
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/flb_pal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 0429d82

Please sign in to comment.