From: Zbigniew Jędrzejewski-Szmek Date: Fri, 7 Oct 2022 14:24:01 +0000 (+0200) Subject: man: recommend strerror_r() over strerror() X-Git-Tag: v252-rc2~70^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2fd922afed57c9a068c6d877b88d41391bea9721;p=thirdparty%2Fsystemd.git man: recommend strerror_r() over strerror() Let's nudge people towards the use of an anonymous buffer like we do internally. "errno" → "errnum", to match the man page for strerror, and also to avoid confusion with the global variable. In general, I think that errno is a terrible interface and we shouldn't encourage people to use it. Those functions use errno-style error numbers, which are a different thing. --- diff --git a/man/sd-bus-errors.xml b/man/sd-bus-errors.xml index a69efe03f01..4b9c2370520 100644 --- a/man/sd-bus-errors.xml +++ b/man/sd-bus-errors.xml @@ -268,7 +268,7 @@ sd_bus_error3, sd_bus_message_set_allow_interactive_authorization3, errno3, - strerror3 + strerror_r3 diff --git a/man/sd_notify.xml b/man/sd_notify.xml index 31388b9c3da..de402950bbb 100644 --- a/man/sd_notify.xml +++ b/man/sd_notify.xml @@ -424,8 +424,8 @@ sd_notifyf(0, "STATUS=Failed to start up: %s\n" "ERRNO=%i", - strerror(errno), - errno); + strerror_r(errnum, (char[1024]){}, 1024), + errnum); diff --git a/src/systemd/sd-daemon.h b/src/systemd/sd-daemon.h index 442b0ac604e..53a1d7ccfe9 100644 --- a/src/systemd/sd-daemon.h +++ b/src/systemd/sd-daemon.h @@ -260,8 +260,8 @@ int sd_notify(int unset_environment, const char *state); sd_notifyf(0, "STATUS=Failed to start up: %s\n" "ERRNO=%i", - strerror(errno), - errno); + strerror_r(errnum, (char[1024]){}, 1024), + errnum); See sd_notifyf(3) for more information. */