aboutsummaryrefslogtreecommitdiff
path: root/console-tools
diff options
context:
space:
mode:
Diffstat (limited to 'console-tools')
-rw-r--r--console-tools/dumpkmap.c6
-rw-r--r--console-tools/loadacm.c5
-rw-r--r--console-tools/loadfont.c4
-rw-r--r--console-tools/openvt.c10
4 files changed, 6 insertions, 19 deletions
diff --git a/console-tools/dumpkmap.c b/console-tools/dumpkmap.c
index 85926556c..19ba77d82 100644
--- a/console-tools/dumpkmap.c
+++ b/console-tools/dumpkmap.c
@@ -51,11 +51,7 @@ int dumpkmap_main(int argc, char **argv)
bb_show_usage();
}
- fd = open(CURRENT_VC, O_RDWR);
- if (fd < 0) {
- bb_perror_msg("Error opening " CURRENT_VC);
- return EXIT_FAILURE;
- }
+ fd=bb_xopen(CURRENT_VC, O_RDWR);
write(1, magic, 7);
diff --git a/console-tools/loadacm.c b/console-tools/loadacm.c
index 640aa4401..edaf51afb 100644
--- a/console-tools/loadacm.c
+++ b/console-tools/loadacm.c
@@ -37,10 +37,7 @@ int loadacm_main(int argc, char **argv)
bb_show_usage();
}
- fd = open(CURRENT_VC, O_RDWR);
- if (fd < 0) {
- bb_perror_msg_and_die("Error opening " CURRENT_VC);
- }
+ fd = bb_xopen(CURRENT_VC, O_RDWR);
if (screen_map_load(fd, stdin)) {
bb_perror_msg_and_die("Error loading acm");
diff --git a/console-tools/loadfont.c b/console-tools/loadfont.c
index 6108151a6..4580dc4e0 100644
--- a/console-tools/loadfont.c
+++ b/console-tools/loadfont.c
@@ -46,9 +46,7 @@ extern int loadfont_main(int argc, char **argv)
if (argc != 1)
bb_show_usage();
- fd = open(CURRENT_VC, O_RDWR);
- if (fd < 0)
- bb_perror_msg_and_die("Error opening " CURRENT_VC);
+ fd = bb_xopen(CURRENT_VC, O_RDWR);
loadnewfont(fd);
return EXIT_SUCCESS;
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)
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);