summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-03-14 09:26:23 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2015-03-14 09:26:23 -0700
commite6c2d9ce12ad784c82ac289f3adbabc06c6ff996 (patch)
tree69c2b5a1fb458fe322f1ee8739e9af05c3110f5c /tools
parent5fb0f7fa7f6e70ac6d8fca07733e55f6dae2969d (diff)
parent9a0b57451ae8142c74d65bddb6d7765818babbed (diff)
downloadlinux-e6c2d9ce12ad784c82ac289f3adbabc06c6ff996.tar.gz
linux-e6c2d9ce12ad784c82ac289f3adbabc06c6ff996.tar.bz2
linux-e6c2d9ce12ad784c82ac289f3adbabc06c6ff996.zip
Merge tag 'linux-kselftest-4.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
Pull Kselftest fix from Shuah Khan: "selftests/exec: Check if the syscall exists and bail if not" * tag 'linux-kselftest-4.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: selftests/exec: Check if the syscall exists and bail if not
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/exec/execveat.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/testing/selftests/exec/execveat.c b/tools/testing/selftests/exec/execveat.c
index e238c9559caf..8d5d1d2ee7c1 100644
--- a/tools/testing/selftests/exec/execveat.c
+++ b/tools/testing/selftests/exec/execveat.c
@@ -30,7 +30,7 @@ static int execveat_(int fd, const char *path, char **argv, char **envp,
#ifdef __NR_execveat
return syscall(__NR_execveat, fd, path, argv, envp, flags);
#else
- errno = -ENOSYS;
+ errno = ENOSYS;
return -1;
#endif
}
@@ -234,6 +234,14 @@ static int run_tests(void)
int fd_cloexec = open_or_die("execveat", O_RDONLY|O_CLOEXEC);
int fd_script_cloexec = open_or_die("script", O_RDONLY|O_CLOEXEC);
+ /* Check if we have execveat at all, and bail early if not */
+ errno = 0;
+ execveat_(-1, NULL, NULL, NULL, 0);
+ if (errno == ENOSYS) {
+ printf("[FAIL] ENOSYS calling execveat - no kernel support?\n");
+ return 1;
+ }
+
/* Change file position to confirm it doesn't affect anything */
lseek(fd, 10, SEEK_SET);