From: Alejandro Colomar Date: Sat, 22 Feb 2025 13:47:22 +0000 (+0100) Subject: lib/get_pid.c: pid_t is a signed integer X-Git-Tag: 4.18.0-rc1~15 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=983a86610c3320bf738847546920ddda9cb5a2b9;p=thirdparty%2Fshadow.git lib/get_pid.c: pid_t is a signed integer Print it with "%d". Acked-by: Lukas Slebodnik Signed-off-by: Alejandro Colomar --- diff --git a/lib/get_pid.c b/lib/get_pid.c index 4a0c2efac..c687eab01 100644 --- a/lib/get_pid.c +++ b/lib/get_pid.c @@ -57,15 +57,15 @@ int open_pidfd(const char *pidstr) if (get_pid(pidstr, &target) == -1) return -ENOENT; - if (SNPRINTF(proc_dir_name, "/proc/%u/", target) == -1) { - fprintf(stderr, "snprintf of proc path failed for %u: %s\n", + if (SNPRINTF(proc_dir_name, "/proc/%d/", target) == -1) { + fprintf(stderr, "snprintf of proc path failed for %d: %s\n", target, strerror(errno)); return -EINVAL; } proc_dir_fd = open(proc_dir_name, O_DIRECTORY); if (proc_dir_fd < 0) { - fprintf(stderr, _("Could not open proc directory for target %u: %s\n"), + fprintf(stderr, _("Could not open proc directory for target %d: %s\n"), target, strerror(errno)); return -EINVAL; }