diff --git a/programs/init.c b/programs/init.c index 7292b0a..4406786 100644 --- a/programs/init.c +++ b/programs/init.c @@ -7,18 +7,23 @@ #include #include #include -#include int main(int argc, char *argv[], char *envp[]) { char *_argv[] = { "login", NULL }; int status; - if (fork() == 0) { - execv("/bin/login", _argv); - printf("This is bad, I should not be here! EXEC NOT WORKING\n"); - } + +#pragma clang diagnostic push +#pragma ide diagnostic ignored "EndlessLoop" while (1) { - wait(&status); + pid_t login = fork(); + if (login == 0) { + execv("/bin/login", _argv); + printf("This is bad, I should not be here! EXEC NOT WORKING\n"); + } + + while (wait(&status) != login); } +#pragma clang diagnostic pop return 0; }