tests/tcg/multiarch/linux-test: Fix error check for shmat
PATCH 1/1 tests/tcg/multiarch/linux-test: Fix error check for shmat
The error indicator for this syscall is -1, not 0.
Signed-off-by Richard Henderson <[email protected]>
--- tests/tcg/multiarch/linux-test.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tests/tcg/multiarch/linux-test.c +2 -1
@@ -503,8 +503,9 @@ static void test_shm(void) shmid =chk_error (shmget (IPC_PRIVATE ,SHM_SIZE ,IPC_CREAT |0777 )); ptr =shmat (shmid,NULL ,0 ); -if (!ptr) +if (ptr == (void *)-1 ) {error ("shmat" ); + }memset (ptr,0 ,SHM_SIZE );
Signature · 1 line
2.17.1
Ping.
Quoted 23 lines · Richard Henderson
The error indicator for this syscall is -1, not 0.
Signed-off-by Richard Henderson <[email protected]>--- tests/tcg/multiarch/linux-test.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)tests/tcg/multiarch/linux-test.c +2
-1@@ -503,8 +503,9 @@ static void test_shm(void) shmid =chk_error (shmget (IPC_PRIVATE ,SHM_SIZE ,IPC_CREAT |0777 )); ptr =shmat (shmid,NULL ,0 ); -if (!ptr) +if (ptr == (void *)-1 ) {error ("shmat" ); + }memset (ptr,0 ,SHM_SIZE );
Quoted 3 lines · Richard Henderson
The error indicator for this syscall is -1, not 0.
Signed-off-by Richard Henderson <[email protected]>
Reviewed-by Emilio G. Cota <[email protected]>
E.