Skip to content

Commit 9c84b89

Browse files
musamaanjumshuahkh
authored andcommitted
selftests: exec: Use new ksft_exit_fail_perror() helper
Use ksft_exit_fail_perror() to print the value of errno and its string form. This is the first user of the ksft_exit_fail_perror() and proves the usefulness of this API. Signed-off-by: Muhammad Usama Anjum <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent 86483f8 commit 9c84b89

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tools/testing/selftests/exec/recursion-depth.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,25 +37,25 @@ int main(void)
3737
ksft_test_result_skip("error: unshare, errno %d\n", errno);
3838
ksft_finished();
3939
}
40-
ksft_exit_fail_msg("error: unshare, errno %d\n", errno);
40+
ksft_exit_fail_perror("error: unshare");
4141
}
4242

4343
if (mount(NULL, "/", NULL, MS_PRIVATE | MS_REC, NULL) == -1)
44-
ksft_exit_fail_msg("error: mount '/', errno %d\n", errno);
44+
ksft_exit_fail_perror("error: mount '/'");
4545

4646
/* Require "exec" filesystem. */
4747
if (mount(NULL, "/tmp", "ramfs", 0, NULL) == -1)
48-
ksft_exit_fail_msg("error: mount ramfs, errno %d\n", errno);
48+
ksft_exit_fail_perror("error: mount ramfs");
4949

5050
#define FILENAME "/tmp/1"
5151

5252
fd = creat(FILENAME, 0700);
5353
if (fd == -1)
54-
ksft_exit_fail_msg("error: creat, errno %d\n", errno);
54+
ksft_exit_fail_perror("error: creat");
5555

5656
#define S "#!" FILENAME "\n"
5757
if (write(fd, S, strlen(S)) != strlen(S))
58-
ksft_exit_fail_msg("error: write, errno %d\n", errno);
58+
ksft_exit_fail_perror("error: write");
5959

6060
close(fd);
6161

0 commit comments

Comments
 (0)