|
|
Message-Id: <20230306085921.34269-1-izbyshev@ispras.ru>
Date: Mon, 6 Mar 2023 11:59:21 +0300
From: Alexey Izbyshev <izbyshev@...ras.ru>
To: musl@...ts.openwall.com
Subject: [PATCH] wait4: fill rusage on x32
Resource usage data is filled by the kernel only when wait4 returns
a pid, i.e. a positive value.
Commit 5850546e9669f793aab61dfc7c4f2c1ff35c4b29 introduced this bug,
possibly because of copy-pasting from getrusage.
---
src/linux/wait4.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/linux/wait4.c b/src/linux/wait4.c
index 83650e34..ff2e3e66 100644
--- a/src/linux/wait4.c
+++ b/src/linux/wait4.c
@@ -12,7 +12,7 @@ pid_t wait4(pid_t pid, int *status, int options, struct rusage *ru)
if (ru) {
long long kru64[18];
r = __syscall(SYS_wait4_time64, pid, status, options, kru64);
- if (!r) {
+ if (r > 0) {
ru->ru_utime = (struct timeval)
{ .tv_sec = kru64[0], .tv_usec = kru64[1] };
ru->ru_stime = (struct timeval)
--
2.39.1
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.