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.
30 lines
588 B
30 lines
588 B
6 years ago
|
|
||
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
#include <string.h>
|
||
|
#include <unistd.h>
|
||
|
#include <errno.h>
|
||
|
|
||
|
#define NAME "node12"
|
||
|
|
||
|
#define WRAP PREFIX "/bin/" NAME
|
||
|
#define REAL PREFIX "/libexec/" NAME "/node"
|
||
|
|
||
|
int main(int argn, char **argv)
|
||
|
{
|
||
|
char *path;
|
||
|
|
||
|
argv[0] = REAL;
|
||
|
if ((path = getenv("NODE")) != NULL)
|
||
|
if (strcmp(path, NAME) != 0 && strcmp(path, WRAP) != 0)
|
||
|
argv[0] = path;
|
||
|
|
||
|
if (execvp(argv[0], argv) == -1) {
|
||
|
fprintf(stderr, "node: ERROR: failed to execute \"%s\": %s\n", argv[0], strerror(errno));
|
||
|
exit(1);
|
||
|
}
|
||
|
|
||
|
return 0;
|
||
|
}
|
||
|
|