[LTP] [PATCH v2] posix/conformance/interfaces/sem_timedwait/2-1: Remove MAP_ANONYMOUS

Cyril Hrubis chrubis@suse.cz
Mon Sep 23 14:54:44 CEST 2024


Hi!
Pushed with two minor changes, thanks.

- POSIX requires that the SHM_NAME starts with /
- Made use of ERROR_PREFIX

Full diff:
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sem_timedwait/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sem_timedwait/2-1.c
index b1747f01d..d9012cc5e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sem_timedwait/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_timedwait/2-1.c
@@ -24,7 +24,7 @@
 #include "posixtest.h"
 
 #define TEST "2-1"
-#define SHM_NAME "posixtest_2-1"
+#define SHM_NAME "/posixtest_2-1"
 #define FUNCTION "sem_timedwait"
 #define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": "
 
@@ -36,17 +36,17 @@ int main(void)
 
        fd = shm_open(SHM_NAME, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
        if (fd == -1) {
-               perror("An error occurs when calling shm_open()");
+               perror(ERROR_PREFIX "shm_open()");
                return PTS_UNRESOLVED;
        }
 
        if (ftruncate(fd, sizeof(*mysemp)) == -1) {
-               perror("An error occurs when calling ftruncate()");
+               perror(ERROR_PREFIX "ftruncate()");
                return PTS_UNRESOLVED;
        }
 
        if (shm_unlink(SHM_NAME) != 0) {
-               perror("An error occurs when calling shm_unlink()");
+               perror(ERROR_PREFIX "shm_unlink()");
                return PTS_UNRESOLVED;
        }


-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list