login: Return 2 when 'disconnect' is provided as a username

This commit is contained in:
K Lange 2021-09-27 21:18:32 +09:00
parent 62368bbf44
commit 2b428defd5
2 changed files with 7 additions and 2 deletions

View File

@ -201,10 +201,11 @@ int main(int argc, char * argv[]) {
};
execvp(args[0], args);
} else {
int result;
int result, status;
do {
result = waitpid(f, NULL, 0);
result = waitpid(f, &status, 0);
} while (result < 0);
if (WEXITSTATUS(status) == 2) break;
}
}

View File

@ -99,6 +99,10 @@ int main(int argc, char ** argv) {
system("reboot");
}
if (!strcmp(username, "disconnect")) {
return 2;
}
fprintf(stdout, "password: ");
fflush(stdout);