Skip to content

Commit

Permalink
syscalls: Add missing exit status check
Browse files Browse the repository at this point in the history
Check exit code via WEXITSTATUS().

Also in madvise08 change exit code to 0 (1 may confuse people into thinking
that the return value actually carries any information, which it does
not since the failure has been already reported. 0 makes it more clear
that we just need to exit the process, nothing more.)

Link: https://lore.kernel.org/ltp/[email protected]/
Reviewed-by: Cyril Hrubis <[email protected]>
Signed-off-by: Petr Vorel <[email protected]>
  • Loading branch information
pevik committed Nov 12, 2024
1 parent 1d4d5a0 commit ffdd3b3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions testcases/kernel/syscalls/madvise/madvise08.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,15 @@ static pid_t run_child(int advice)
fmem,
FMEMSIZE,
advstr);
exit(1);
exit(0);
}
abort();
}

SAFE_WAITPID(pid, &status, 0);
if (WIFSIGNALED(status) && WCOREDUMP(status))
return pid;
if (WIFEXITED(status))
if (WIFEXITED(status) && !WEXITSTATUS(status))
return 0;

tst_res(TCONF, "No coredump produced after signal (%d)",
Expand Down
2 changes: 1 addition & 1 deletion testcases/kernel/syscalls/select/select03.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ static void run(unsigned int n)

SAFE_WAITPID(pid, &status, 0);

if (WIFEXITED(status))
if (WIFEXITED(status) && !WEXITSTATUS(status))
return;

if (tst_variant == GLIBC_SELECT_VARIANT &&
Expand Down

0 comments on commit ffdd3b3

Please sign in to comment.