From: Peter Korsgaard Date: Thu, 26 May 2011 15:51:37 +0000 (+0200) Subject: setconsole: open console for writing rather than reading X-Git-Tag: 1_19_0~85 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=8dc6195c97e6bfc70a0158bce40c87d74d1a83d6;p=oweals%2Fbusybox.git 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 Signed-off-by: Denys Vlasenko --- 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; }