forked from Minki/linux
Kselftest fixes for Linux 4.0-rc4
selftests/exec: Check if the syscall exists and bail if not -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJVAxU6AAoJEAsCRMQNDUMcFEMQAI4yi+TLfd4Eyv6EDPmwIcZL 2oBRON3IaAHtmcaONdQHNgR3qcJwkOSe0/yHfpWH+0HbyBZxRSWjlyUyH7yTcEh+ twq5tDSglamS0e0+616l4/WJkIBUgBqA+7gTXrvNOqWbmR3thijbXiOfDBsPAZ+S TjbkrQJKu1QAUFxNVP7LCYEmh9X/Z/4tzHKNXrrKLmkY4L/q7zvKdtwzLD/EAnFC R11CwzAMtWcpjcFreRveOxEb6MLs8z2XsbsVjdTNX9vC5RHhfGQqYrHBFwkEL+Bn JVknsaAlHRtKkGEDdqSCjwDU4+RalP1iDw+ZgtyBBql+cQMZ/xcoJ2/gVc5Ay7PD t3IN8LFbw0Sv9mBJp6GTVnWWSeAzOdH7K3C7NWTEmOP6U6PGhXBOQnYwCGyFlviI 69CyUmbCTQLm70/uarVJowGFLvxatem/OX9mUuyI1tcurloqf3o5D1KQhAk7vY2+ XTBHbftugZIOE9QQS1vb2I4rB4rKn2L2S2mdFO8iOsMIedZ7GeM/VfjnqzARv79T BIJUcEWz+Fd2NEn2aM8f32r4NJA9SVSn4uy6L356OG4BUUiBxLciZmm4HVweJjUi U3x3sVZvAGUYbC4cKXak6AQpVfuuujy8dH1jVe8J4IaoWmfjOprZBbmJ7P4NTUHQ arQGuA1eEnxLj8/jSPSW =WFmj -----END PGP SIGNATURE----- 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
This commit is contained in:
commit
e6c2d9ce12
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user