summaryrefslogtreecommitdiff
path: root/samples/check-exec/inc.c
diff options
context:
space:
mode:
Diffstat (limited to 'samples/check-exec/inc.c')
-rw-r--r--samples/check-exec/inc.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/samples/check-exec/inc.c b/samples/check-exec/inc.c
index 94b87569d2a2..7f6ef06a2f06 100644
--- a/samples/check-exec/inc.c
+++ b/samples/check-exec/inc.c
@@ -21,8 +21,15 @@
#include <stdlib.h>
#include <string.h>
#include <sys/prctl.h>
+#include <sys/syscall.h>
#include <unistd.h>
+static int sys_execveat(int dirfd, const char *pathname, char *const argv[],
+ char *const envp[], int flags)
+{
+ return syscall(__NR_execveat, dirfd, pathname, argv, envp, flags);
+}
+
/* Returns 1 on error, 0 otherwise. */
static int interpret_buffer(char *buffer, size_t buffer_size)
{
@@ -78,8 +85,8 @@ static int interpret_stream(FILE *script, char *const script_name,
* script execution. We must use the script file descriptor instead of
* the script path name to avoid race conditions.
*/
- err = execveat(fileno(script), "", script_argv, envp,
- AT_EMPTY_PATH | AT_EXECVE_CHECK);
+ err = sys_execveat(fileno(script), "", script_argv, envp,
+ AT_EMPTY_PATH | AT_EXECVE_CHECK);
if (err && restrict_stream) {
perror("ERROR: Script execution check");
return 1;