Dmitry V. Levin | 7c22101 | 2015-07-26 11:06:53 +0000 | [diff] [blame] | 1 | #ifdef HAVE_CONFIG_H |
| 2 | # include "config.h" |
| 3 | #endif |
| 4 | |
| 5 | #include <unistd.h> |
| 6 | #include <sys/syscall.h> |
| 7 | |
| 8 | #ifdef __NR_execveat |
| 9 | |
| 10 | #define FILENAME "execveat\nfilename" |
| 11 | static const char * const argv[] = |
| 12 | { FILENAME, "first", "second", NULL, NULL, NULL }; |
| 13 | static const char * const envp[] = |
| 14 | { "foobar=1", "foo\nbar=2", NULL , "", NULL , "", NULL, NULL}; |
| 15 | |
| 16 | int |
| 17 | main(void) |
| 18 | { |
| 19 | syscall(__NR_execveat, -100, FILENAME, argv, envp, 0x1100); |
| 20 | return 0; |
| 21 | } |
| 22 | |
| 23 | #else |
| 24 | |
| 25 | int |
| 26 | main(void) |
| 27 | { |
| 28 | return 77; |
| 29 | } |
| 30 | |
| 31 | #endif |