[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox-cvs
Subject:    [git commit] setconsole: open console for writing rather than reading
From:       vda.linux () googlemail ! com (Denys Vlasenko)
Date:       2011-05-28 23:51:33
Message-ID: 20110528235144.38520836BB () busybox ! osuosl ! org
[Download RAW message or body]


commit: http://git.busybox.net/busybox/commit/?id=8dc6195c97e6bfc70a0158bce40c87d74d1a83d6
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

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 at sunsite.dk>
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 console-tools/setconsole.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/console-tools/setconsole.c b/console-tools/setconsole.c
index 59c8336..771974a 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;
 }
-- 
1.7.3.4


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic