diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2022-10-07 16:24:01 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2022-10-11 16:59:00 +0200 |
commit | 2fd922afed57c9a068c6d877b88d41391bea9721 (patch) | |
tree | 855fec6b73974f534e4998ea2ecbdf9b68fb76c6 | |
parent | b4096cecffd13491848b84bc27f00dbee06af52e (diff) | |
download | systemd-2fd922afed57c9a068c6d877b88d41391bea9721.tar.gz |
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.
-rw-r--r-- | man/sd-bus-errors.xml | 2 | ||||
-rw-r--r-- | man/sd_notify.xml | 4 | ||||
-rw-r--r-- | src/systemd/sd-daemon.h | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/man/sd-bus-errors.xml b/man/sd-bus-errors.xml index a69efe03f0..4b9c237052 100644 --- a/man/sd-bus-errors.xml +++ b/man/sd-bus-errors.xml @@ -268,7 +268,7 @@ <citerefentry><refentrytitle>sd_bus_error</refentrytitle><manvolnum>3</manvolnum></citerefentry>, <citerefentry><refentrytitle>sd_bus_message_set_allow_interactive_authorization</refentrytitle><manvolnum>3</manvolnum></citerefentry>, <citerefentry project='man-pages'><refentrytitle>errno</refentrytitle><manvolnum>3</manvolnum></citerefentry>, - <citerefentry project='die-net'><refentrytitle>strerror</refentrytitle><manvolnum>3</manvolnum></citerefentry> + <citerefentry project='die-net'><refentrytitle>strerror_r</refentrytitle><manvolnum>3</manvolnum></citerefentry> </para> </refsect1> diff --git a/man/sd_notify.xml b/man/sd_notify.xml index 31388b9c3d..de402950bb 100644 --- a/man/sd_notify.xml +++ b/man/sd_notify.xml @@ -424,8 +424,8 @@ <programlisting>sd_notifyf(0, "STATUS=Failed to start up: %s\n" "ERRNO=%i", - strerror(errno), - errno);</programlisting> + strerror_r(errnum, (char[1024]){}, 1024), + errnum);</programlisting> </example> <example> diff --git a/src/systemd/sd-daemon.h b/src/systemd/sd-daemon.h index 442b0ac604..53a1d7ccfe 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. */ |