aboutsummaryrefslogtreecommitdiff
path: root/console-tools/setconsole.c
diff options
context:
space:
mode:
authorGravatar Rob Landley <rob@landley.net>2005-09-08 03:27:06 +0000
committerGravatar Rob Landley <rob@landley.net>2005-09-08 03:27:06 +0000
commit9f0e00fc61858a0e3cc6711b78e95c57b484ef7c (patch)
treec7b8e35296501484d82d6ac84ae1685df3339ccb /console-tools/setconsole.c
parent230b411de87219f8a59e5d4061d7908cd44ed4d7 (diff)
downloadbusybox-9f0e00fc61858a0e3cc6711b78e95c57b484ef7c.tar.gz
busybox-9f0e00fc61858a0e3cc6711b78e95c57b484ef7c.tar.bz2
Tito sent more size tweaks.
Diffstat (limited to 'console-tools/setconsole.c')
-rw-r--r--console-tools/setconsole.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/console-tools/setconsole.c b/console-tools/setconsole.c
index 53ff1ad1e..5806f21ed 100644
--- a/console-tools/setconsole.c
+++ b/console-tools/setconsole.c
@@ -37,9 +37,8 @@ static const struct option setconsole_long_options[] = {
int setconsole_main(int argc, char **argv)
{
- int con;
unsigned long flags;
- const char *device = "/dev/tty";
+ const char *device = CURRENT_TTY;
bb_applet_long_options = setconsole_long_options;
flags = bb_getopt_ulflags(argc, argv, "r");
@@ -53,14 +52,11 @@ int setconsole_main(int argc, char **argv)
device = argv[optind];
} else {
if (flags & OPT_SETCONS_RESET)
- device = "/dev/console";
+ device = CONSOLE_DEV;
}
- if (-1 == (con = open(device, O_RDONLY))) {
- bb_perror_msg_and_die("open %s", device);
- }
- if (-1 == ioctl(con, TIOCCONS)) {
- bb_perror_msg_and_die("ioctl TIOCCONS");
+ if (-1 == ioctl(bb_xopen(device, O_RDONLY), TIOCCONS)) {
+ bb_perror_msg_and_die("TIOCCONS");
}
return EXIT_SUCCESS;
}