You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
636 B
31 lines
636 B
|
|
#include <stdio.h> |
|
#include <stdlib.h> |
|
#include <string.h> |
|
#include <unistd.h> |
|
|
|
#define PM2_BINDIR "@l_prefix@/bin" |
|
#define PM2_VARDIR "@l_prefix@/var/pm2/run" |
|
#define PM2_BIN "@l_prefix@/bin/pm2" |
|
|
|
int main(int argn, char **argv) |
|
{ |
|
static char *env[] = { |
|
"PATH=/bin:/usr/bin:/sbin:/usr/sbin:" PM2_BINDIR, |
|
"HOME=" PM2_VARDIR, |
|
NULL |
|
}; |
|
if (setuid(geteuid()) == -1) { |
|
perror("setuid"); |
|
exit(1); |
|
} |
|
if (setgid(getegid()) == -1) { |
|
perror("setgid"); |
|
exit(1); |
|
} |
|
argv[0] = PM2_BIN; |
|
if (execve(argv[0], argv, env) == -1) |
|
abort(); |
|
return 0; |
|
} |
|
|
|
|