File: execve.c

package info (click to toggle)
python-ptrace 0.9.9-0.2
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 788 kB
  • sloc: python: 10,167; ansic: 263; makefile: 164
file content (22 lines) | stat: -rw-r--r-- 357 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <unistd.h>
#include <sys/wait.h>
#include <stdlib.h>
#include <sys/utsname.h>

int main()
{
    char *arg[]= {"/bin/ls", NULL };
    int pid;

    pid = fork();

    if (pid) {
        waitpid(pid, NULL, 0);
        exit(EXIT_SUCCESS);
    } else {
        (void)uname(NULL);
        execve(arg[0], arg, NULL);
        exit(EXIT_FAILURE);
    }
}