Alexandra Hájková 6f6ff49ffa Add support for execveat syscall
Refactor the code to be reusable between execve and
execveat syscalls.

https://bugs.kde.org/show_bug.cgi?id=345077
2020-06-08 20:58:09 +02:00

19 lines
336 B
C

#include <sys/syscall.h>
#include <errno.h>
#include <unistd.h>
#include <stddef.h>
int main(int argc, char **argv)
{
int has_execveat = 0;
#if defined(__NR_execveat)
errno = 0;
syscall(__NR_execveat, 0, NULL, 0, 0, 0);
has_execveat = (errno != ENOSYS);
#else
has_execveat = 0;
#endif
return has_execveat ? 0 : 1;
}