Skip to content

Commit

Permalink
tests/tcg/multiarch/linux-test: Fix error check for shmat
Browse files Browse the repository at this point in the history
The error indicator for this syscall is -1, not 0.

Fixes: e374bfa ("shm tests - disabled clone test")
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20191106113318.10226-3-richard.henderson@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
  • Loading branch information
rth7680 authored and vivier committed Nov 6, 2019
1 parent 7c81570 commit 3d72543
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/tcg/multiarch/linux-test.c
Expand Up @@ -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);

Expand Down

0 comments on commit 3d72543

Please sign in to comment.