aboutsummaryrefslogtreecommitdiff
path: root/toys/chvt.c
diff options
context:
space:
mode:
Diffstat (limited to 'toys/chvt.c')
-rw-r--r--toys/chvt.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/toys/chvt.c b/toys/chvt.c
index 445b8f71..6504bff1 100644
--- a/toys/chvt.c
+++ b/toys/chvt.c
@@ -53,9 +53,9 @@ void chvt_main(void)
vtnum=atoi(*toys.optargs);
fd=get_console_fd();
- if (fd < 0) return;
-
- if (ioctl(fd,VT_ACTIVATE,vtnum)) return;
-
- if (ioctl(fd,VT_WAITACTIVE,vtnum)) return;
+ if (fd < 0 || ioctl(fd,VT_ACTIVATE,vtnum)
+ || ioctl(fd,VT_WAITACTIVE,vtnum))
+ {
+ perror_exit(NULL);
+ }
}