22 lines
324 B
C
22 lines
324 B
C
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
#include <errno.h>
|
|
#include <unistd.h>
|
|
#include "unused.h"
|
|
|
|
int main(int argc, char **argv) {
|
|
UNUSED(argc);
|
|
|
|
if (argv[1] == NULL) {
|
|
printf("setsid [cmd] [arg1 arg2...]\n");
|
|
return 1;
|
|
}
|
|
|
|
if (fork() != 0)
|
|
return 0;
|
|
|
|
setsid();
|
|
execvp(argv[1], argv + 1);
|
|
}
|