Skip to content

Commit

Permalink
reboot: try and use init first
Browse files Browse the repository at this point in the history
  • Loading branch information
EtchedPixels committed May 9, 2023
1 parent b450c3b commit e85587a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Applications/util/reboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
static int telinit(unsigned char c)
{
int fd = open("/var/run/initctl", O_WRONLY|O_TRUNC|O_CREAT, 0600);
if (fd < 0 || write(fd, &c, 1) != 1 || close(fd) == -1 ||
if (fd < 0 || write(fd, &c, 1) != 1 || close(fd) == -1 ||
kill(1, SIGUSR1) < 0)
return 0;
return 1;
Expand Down Expand Up @@ -45,7 +45,7 @@ int main(int argc, char *argv[])
else if (strcmp(p, "suspend") == 0)
uadmin(A_SUSPEND, pv, 0);
else {
if (telinit(5))
if (pv == 0 && telinit(5))
exit(0);
uadmin(A_REBOOT, pv, 0);
}
Expand Down

0 comments on commit e85587a

Please sign in to comment.