From a120e68518928249d35e14e1857ec6d49dacdaa0 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 18 Aug 2023 14:59:29 +0200 Subject: [PATCH] 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 c42f6f0997d5399a9b212803f583a0c22983fbc5) (cherry picked from commit 93359f2b322789d63fe049ea975a07301f99eef7) --- src/nm-daemon-helper/nm-daemon-helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nm-daemon-helper/nm-daemon-helper.c b/src/nm-daemon-helper/nm-daemon-helper.c index 5faacf43f3..32be93a4ef 100644 --- a/src/nm-daemon-helper/nm-daemon-helper.c +++ b/src/nm-daemon-helper/nm-daemon-helper.c @@ -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",