Dmitry V. Levin
7c2210190a
* execve.c (decode_execve): New function. (sys_execve): Use it. (sys_execveat): New function. * linux/dummy.h (sys_execveat): Remove. * tests/execveat.c: New file. * tests/execveat.expected: Likewise. * tests/execveat-v.expected: Likewise. * tests/execveat.test: New test. * tests/Makefile.am (check_PROGRAMS): Add execveat. (TESTS): Add execveat.test. (EXTRA_DIST): Add execveat.expected and execveat-v.expected. * tests/.gitignore: Add execveat.
32 lines
481 B
C
32 lines
481 B
C
#ifdef HAVE_CONFIG_H
|
|
# include "config.h"
|
|
#endif
|
|
|
|
#include <unistd.h>
|
|
#include <sys/syscall.h>
|
|
|
|
#ifdef __NR_execveat
|
|
|
|
#define FILENAME "execveat\nfilename"
|
|
static const char * const argv[] =
|
|
{ FILENAME, "first", "second", NULL, NULL, NULL };
|
|
static const char * const envp[] =
|
|
{ "foobar=1", "foo\nbar=2", NULL , "", NULL , "", NULL, NULL};
|
|
|
|
int
|
|
main(void)
|
|
{
|
|
syscall(__NR_execveat, -100, FILENAME, argv, envp, 0x1100);
|
|
return 0;
|
|
}
|
|
|
|
#else
|
|
|
|
int
|
|
main(void)
|
|
{
|
|
return 77;
|
|
}
|
|
|
|
#endif
|