From 651e253b836d98f0fa1ed38e2aa0cf1e701f9171 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sun, 27 Jan 2008 15:26:32 -0600 Subject: [PATCH] Have chvt print an error message (and exit with error) when it fails. --- toys/chvt.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/toys/chvt.c b/toys/chvt.c index 445b8f7..6504bff 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); + } } -- 2.7.4