From bb113fe0b0e209681b1c0d6317440bf64f57ea80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89rico=20Nogueira?= Date: Tue, 27 Apr 2021 17:46:17 -0300 Subject: [PATCH] fix sem_close regression test sem_close with O_CREAT takes 4 parameters, not 3. The last parameter, the initial value for the semaphore, had an arbitrary value from whatever was on the stack, and lead to spurious failures with EINVAL when it happened to be greater than SEM_VALUE_MAX. Since there isn't error checking in this test, this lead to a segfault in the first sem_post call. --- src/regression/sem_close-unmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/regression/sem_close-unmap.c b/src/regression/sem_close-unmap.c index f1e51d9..73c53e3 100644 --- a/src/regression/sem_close-unmap.c +++ b/src/regression/sem_close-unmap.c @@ -8,7 +8,7 @@ int main() char buf[] = "mysemXXXXXX"; if (!mktemp(buf)) return 1; // open twice - sem_t *sem = sem_open(buf, O_CREAT|O_EXCL, 0600); + sem_t *sem = sem_open(buf, O_CREAT|O_EXCL, 0600, 0); sem_open(buf, 0); sem_unlink(buf); // close once -- 2.31.1