diff options
author | Rob Landley <rob@landley.net> | 2008-01-27 15:26:32 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2008-01-27 15:26:32 -0600 |
commit | 651e253b836d98f0fa1ed38e2aa0cf1e701f9171 (patch) | |
tree | 4e41e614e0a456844b3a29851a19c5787c7d4368 /toys/chvt.c | |
parent | 12138e498721892320e703702dcd3a4b191fb7fc (diff) | |
download | toybox-651e253b836d98f0fa1ed38e2aa0cf1e701f9171.tar.gz |
Have chvt print an error message (and exit with error) when it fails.
Diffstat (limited to 'toys/chvt.c')
-rw-r--r-- | toys/chvt.c | 10 |
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); + } } |