mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-21 01:20:28 +01:00
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.
This commit is contained in:
parent
59251cae45
commit
c42f6f0997
1 changed files with 5 additions and 2 deletions
|
|
@ -94,12 +94,15 @@ cmd_resolve_address(void)
|
|||
NI_NAMEREQD);
|
||||
if (ret != 0) {
|
||||
if (ret == EAI_SYSTEM) {
|
||||
int errsv = errno;
|
||||
char buf[1024];
|
||||
|
||||
fprintf(stderr,
|
||||
"getnameinfo() failed: %d (%s), system error: %d (%s)\n",
|
||||
ret,
|
||||
gai_strerror(ret),
|
||||
errno,
|
||||
strerror(errno));
|
||||
errsv,
|
||||
_nm_strerror_r(errsv, buf, sizeof(buf)));
|
||||
} else {
|
||||
fprintf(stderr, "getnameinfo() failed: %d (%s)\n", ret, gai_strerror(ret));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue