aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Korsgaard <jacmet@sunsite.dk>2011-05-26 17:51:37 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2011-05-29 01:51:33 +0200
commit8dc6195c97e6bfc70a0158bce40c87d74d1a83d6 (patch)
tree3e428027ff4670b245da7f21ae726d5cb800df14
parentabb0952e63ed09a5bd5d73346305f6403b45d47d (diff)
downloadbusybox-8dc6195c97e6bfc70a0158bce40c87d74d1a83d6.tar.gz
setconsole: open console for writing rather than reading
The console passed to TIOCCONS has to be writable, otherwise future console writes will fail. This presumably used to work, but in current kernels (see drivers/tty/tty_io.c:redirected_tty_write) console writes are sent to vfs_write(device), which checks if the device is writable. A quick look in the linux git history doesn't show any recent changes to either tty_io or vfs_write. Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--console-tools/setconsole.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/console-tools/setconsole.c b/console-tools/setconsole.c
index 59c83361c..771974ae3 100644
--- a/console-tools/setconsole.c
+++ b/console-tools/setconsole.c
@@ -41,6 +41,6 @@ int setconsole_main(int argc UNUSED_PARAM, char **argv)
device = DEV_CONSOLE;
}
- xioctl(xopen(device, O_RDONLY), TIOCCONS, NULL);
+ xioctl(xopen(device, O_WRONLY), TIOCCONS, NULL);
return EXIT_SUCCESS;
}