[CRIU] [PATCH 4/4] unix: don't use %m in pr_warn
Andrei Vagin
avagin at virtuozzo.com
Wed May 16 01:55:59 MSK 2018
pr_warn calls a few system calls before printing a message,
so it will override errno.
CID 190176 (#1 of 1): Printf format string issue (PW.BAD_PRINTF_FORMAT_STRING)
1. bad_printf_format_string: invalid format string conversion
Signed-off-by: Andrei Vagin <avagin at virtuozzo.com>
---
criu/sk-unix.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/criu/sk-unix.c b/criu/sk-unix.c
index ea314bb9f..2838958d6 100644
--- a/criu/sk-unix.c
+++ b/criu/sk-unix.c
@@ -595,8 +595,8 @@ static int unix_resolve_name(int lfd, u32 id, struct unix_sk_desc *d,
snprintf(rpath, sizeof(rpath), ".%s", name);
if (fstatat(mntns_root, rpath, &st, 0)) {
if (errno != ENOENT) {
- pr_warn("Can't stat socket %#x(%s), skipping: %m (err %d)\n",
- id, rpath, errno);
+ pr_warn("Can't stat socket %#x(%s), skipping: %s (err %d)\n",
+ id, rpath, strerror(errno), errno);
goto skip;
}
--
2.14.3
More information about the CRIU
mailing list