diff options
Diffstat (limited to 'sd.c')
-rw-r--r-- | sd.c | 16 |
1 files changed, 7 insertions, 9 deletions
@@ -33,15 +33,14 @@ static const char *conspath[] = { static int fd_con = -1; static struct vt_stat vts; -static int vt_num = -1; static char vt_dev[PATH_MAX + 1]; static int vt_fd = -1; static pid_t chld = -1; static int vt_switch(int to) { if (to) { - IOCTL(fd_con, VT_ACTIVATE, vt_num) - IOCTL(fd_con, VT_WAITACTIVE, vt_num) + IOCTL(fd_con, VT_ACTIVATE, p_env.vt) + IOCTL(fd_con, VT_WAITACTIVE, p_env.vt) } else { IOCTL(fd_con, VT_ACTIVATE, vts.v_active) IOCTL(fd_con, VT_WAITACTIVE, vts.v_active) @@ -99,9 +98,8 @@ static int main_sak(void) { dprintf(fd, "\033[r\033[H\033[J" "Press SysRq + K to continue.\n"); /* Wait for signal. */ - while (1) { - pause(); - } + pause(); + return 0; } int sd_setup(void) { @@ -109,8 +107,8 @@ int sd_setup(void) { return 1; } IOCTL(fd_con, VT_GETSTATE, &vts) - IOCTL(fd_con, VT_OPENQRY, &vt_num) - snprintf(vt_dev, PATH_MAX, "/dev/tty%d", vt_num); + IOCTL(fd_con, VT_OPENQRY, &p_env.vt) + snprintf(vt_dev, PATH_MAX, "/dev/tty%d", p_env.vt); if (!(chld = fork())) { exit(main_sak()); @@ -194,7 +192,7 @@ void sd_cleanup(void) { if (vt_switch(0)) { LOGEV("Cannot return to the previous console: %m", errno); } - if (ioctl(fd_con, VT_DISALLOCATE, vt_num) < 0) { + if (ioctl(fd_con, VT_DISALLOCATE, p_env.vt) < 0) { LOGEV("Cannot deallocate console: %m", errno); } close(fd_con); |