Mercurial > hg > toybox
diff toys/chvt.c @ 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 | e6273440c9c0 |
children | 17c0a2013852 |
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); + } }