From 7f2fd174c4ba47807217c6722b17fe4a7488c161 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Sj=C3=B6lund?= Date: Thu, 13 Aug 2026 21:51:09 +0200 Subject: [PATCH] utils: use || instead of | in waitpid_ignore_stopped MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit WIFSTOPPED() and WIFCONTINUED() are boolean predicates, but POSIX only specifies that they evaluate to a non-zero value for a matching status, not that they evaluate to exactly 1. Combining them with the bitwise OR operator therefore relies on a property the standard does not guarantee. glibc and musl both happen to expand these macros to a comparison, so the current code works there, but the logical OR operator expresses the intent directly and does not depend on the values being normalized. Co-Authored-By: Claude Opus 5 Signed-off-by: Erik Sjölund --- src/libcrun/utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcrun/utils.h b/src/libcrun/utils.h index 4e8d100790..5db3ee954a 100644 --- a/src/libcrun/utils.h +++ b/src/libcrun/utils.h @@ -450,7 +450,7 @@ waitpid_ignore_stopped (pid_t pid, int *status, int options) ret = TEMP_FAILURE_RETRY (waitpid (pid, &s, options)); if (ret < 0) return ret; - } while (WIFSTOPPED (s) | WIFCONTINUED (s)); + } while (WIFSTOPPED (s) || WIFCONTINUED (s)); if (status) *status = s;