mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-17 10:46:33 +00:00
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 <usama.anjum@collabora.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
This commit is contained in:
parent
86483f8b4e
commit
9c84b890b8
@ -37,25 +37,25 @@ int main(void)
|
||||
ksft_test_result_skip("error: unshare, errno %d\n", errno);
|
||||
ksft_finished();
|
||||
}
|
||||
ksft_exit_fail_msg("error: unshare, errno %d\n", errno);
|
||||
ksft_exit_fail_perror("error: unshare");
|
||||
}
|
||||
|
||||
if (mount(NULL, "/", NULL, MS_PRIVATE | MS_REC, NULL) == -1)
|
||||
ksft_exit_fail_msg("error: mount '/', errno %d\n", errno);
|
||||
ksft_exit_fail_perror("error: mount '/'");
|
||||
|
||||
/* Require "exec" filesystem. */
|
||||
if (mount(NULL, "/tmp", "ramfs", 0, NULL) == -1)
|
||||
ksft_exit_fail_msg("error: mount ramfs, errno %d\n", errno);
|
||||
ksft_exit_fail_perror("error: mount ramfs");
|
||||
|
||||
#define FILENAME "/tmp/1"
|
||||
|
||||
fd = creat(FILENAME, 0700);
|
||||
if (fd == -1)
|
||||
ksft_exit_fail_msg("error: creat, errno %d\n", errno);
|
||||
ksft_exit_fail_perror("error: creat");
|
||||
|
||||
#define S "#!" FILENAME "\n"
|
||||
if (write(fd, S, strlen(S)) != strlen(S))
|
||||
ksft_exit_fail_msg("error: write, errno %d\n", errno);
|
||||
ksft_exit_fail_perror("error: write");
|
||||
|
||||
close(fd);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user