summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Izbyshev <izbyshev@ispras.ru>2023-03-06 11:59:21 +0300
committerRich Felker <dalias@aerifal.cx>2023-04-11 09:23:44 -0400
commitc1b42c4a3a0324ec25877980f59db233fa420925 (patch)
tree85fb1a9f254a6b8d98329135e2f60ea1bda1f729
parent9b12982d52c5bc5b0158c07dfdbd5485f3a773a0 (diff)
downloadmusl-c1b42c4a3a0324ec25877980f59db233fa420925.tar.gz
wait4: fix missing rusage on x32 due to wrong success condition
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.
-rw-r--r--src/linux/wait4.c2
1 files changed, 1 insertions, 1 deletions
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)