summaryrefslogtreecommitdiff
path: root/console-tools/openvt.c
diff options
context:
space:
mode:
authorGlenn L McGrath2003-12-20 06:00:08 +0000
committerGlenn L McGrath2003-12-20 06:00:08 +0000
commit02e035550456f7ebce6306f6023e87a7c1d44749 (patch)
tree67f124028fe1b297bab3c325e6f5783ac20004a6 /console-tools/openvt.c
parent236e93d133ff80fae0a0fb5f8912a049e6ead4ac (diff)
downloadbusybox-02e035550456f7ebce6306f6023e87a7c1d44749.zip
busybox-02e035550456f7ebce6306f6023e87a7c1d44749.tar.gz
Use bb_xopen
Diffstat (limited to 'console-tools/openvt.c')
-rw-r--r--console-tools/openvt.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/console-tools/openvt.c b/console-tools/openvt.c
index 269dfc0..bafd1d0 100644
--- a/console-tools/openvt.c
+++ b/console-tools/openvt.c
@@ -48,11 +48,8 @@ int openvt_main(int argc, char **argv)
if (!isdigit(argv[1][0]))
bb_show_usage();
- vtno = (int) atol(argv[1]);
-
- /* if (vtno <= 0 || vtno > 63) */
- if (vtno <= 0 || vtno > 12)
- bb_error_msg_and_die("Illegal vt number (%d)", vtno);
+ /* check for Illegal vt number */
+ vtno=bb_xgetlarg(argv[1], 10, 1, 12);
sprintf(vtname, VTNAME, vtno);
@@ -73,8 +70,7 @@ int openvt_main(int argc, char **argv)
close(0); /* so that new vt becomes stdin */
/* and grab new one */
- if ((fd = open(vtname, O_RDWR)) == -1)
- bb_perror_msg_and_die("could not open %s", vtname);
+ fd = bb_xopen(vtname, O_RDWR);
/* Reassign stdout and sterr */
close(1);