Mercurial > hg > toybox
changeset 246:d9ea4ca7ae8c
Have chvt print an error message (and exit with error) when it fails.
author | Rob Landley <rob@landley.net> |
---|---|
date | Sun, 27 Jan 2008 15:26:32 -0600 |
parents | 67a0839bda77 |
children | 085395c1471d |
files | toys/chvt.c |
diffstat | 1 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/toys/chvt.c Sun Jan 27 15:26:08 2008 -0600 +++ b/toys/chvt.c Sun Jan 27 15:26:32 2008 -0600 @@ -53,9 +53,9 @@ 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); + } }