mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Retrieve init process id from INIT_PID environmental variable.
This commit is contained in:
parent
f8f65d5713
commit
6ea41cc620
1 changed files with 7 additions and 1 deletions
|
@ -326,7 +326,13 @@ int get_and_run_command(FILE* fp, const char* fpname, bool interactive,
|
||||||
*exitexec = true;
|
*exitexec = true;
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
if ( getppid() == 1 )
|
const char* init_pid_str = getenv("INIT_PID");
|
||||||
|
if ( !init_pid_str)
|
||||||
|
init_pid_str = "1";
|
||||||
|
pid_t init_pid = (pid_t) atol(init_pid_str);
|
||||||
|
if ( !init_pid )
|
||||||
|
init_pid = 1;
|
||||||
|
if ( getppid() == init_pid )
|
||||||
{
|
{
|
||||||
printf("\nType exit to shutdown the system.\n");
|
printf("\nType exit to shutdown the system.\n");
|
||||||
return status;
|
return status;
|
||||||
|
|
Loading…
Reference in a new issue