aboutsummaryrefslogtreecommitdiff
path: root/console-tools/openvt.c
diff options
context:
space:
mode:
authorbug1 <bug1@69ca8d6d-28ef-0310-b511-8ec308f3f277>2003-12-20 06:00:08 +0000
committerbug1 <bug1@69ca8d6d-28ef-0310-b511-8ec308f3f277>2003-12-20 06:00:08 +0000
commit523204dd9f886fa7ed83b14fb6877c6970b55b3b (patch)
tree67f124028fe1b297bab3c325e6f5783ac20004a6 /console-tools/openvt.c
parentb00c324c442b5a5caf8131211c44881349f5e309 (diff)
downloadbusybox-w32-523204dd9f886fa7ed83b14fb6877c6970b55b3b.tar.gz
busybox-w32-523204dd9f886fa7ed83b14fb6877c6970b55b3b.tar.bz2
busybox-w32-523204dd9f886fa7ed83b14fb6877c6970b55b3b.zip
Use bb_xopen
git-svn-id: svn://busybox.net/trunk/busybox@8144 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to '')
-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 269dfc01a..bafd1d0a2 100644
--- a/console-tools/openvt.c
+++ b/console-tools/openvt.c
@@ -48,11 +48,8 @@ int openvt_main(int argc, char **argv)
48 if (!isdigit(argv[1][0])) 48 if (!isdigit(argv[1][0]))
49 bb_show_usage(); 49 bb_show_usage();
50 50
51 vtno = (int) atol(argv[1]); 51 /* check for Illegal vt number */
52 52 vtno=bb_xgetlarg(argv[1], 10, 1, 12);
53 /* if (vtno <= 0 || vtno > 63) */
54 if (vtno <= 0 || vtno > 12)
55 bb_error_msg_and_die("Illegal vt number (%d)", vtno);
56 53
57 sprintf(vtname, VTNAME, vtno); 54 sprintf(vtname, VTNAME, vtno);
58 55
@@ -73,8 +70,7 @@ int openvt_main(int argc, char **argv)
73 close(0); /* so that new vt becomes stdin */ 70 close(0); /* so that new vt becomes stdin */
74 71
75 /* and grab new one */ 72 /* and grab new one */
76 if ((fd = open(vtname, O_RDWR)) == -1) 73 fd = bb_xopen(vtname, O_RDWR);
77 bb_perror_msg_and_die("could not open %s", vtname);
78 74
79 /* Reassign stdout and sterr */ 75 /* Reassign stdout and sterr */
80 close(1); 76 close(1);