daemon-helper: use _nm_strerror_r() to avoid non-thread-safe strerror()

Yes, there probably are not multiple threads here. It's a matter of principle to
not use smelly functions.

Also, copy the "errno" value we want to print, before calling various functions.

(cherry picked from commit c42f6f0997)
This commit is contained in:
Thomas Haller 2023-08-18 14:59:29 +02:00 committed by Fernando Fernandez Mancera
parent 524febf271
commit 93359f2b32

View file

@ -120,8 +120,8 @@ cmd_resolve_address(void)
service,
ret,
gai_strerror(ret),
errno,
strerror(errno));
errsv,
_nm_strerror_r(errsv, buf, sizeof(buf)));
} else {
fprintf(stderr,
"getnameinfo() via service '%s' failed: %d (%s)\n",