diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2018-04-16 21:48:32 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2018-04-16 21:48:32 +0200 |
commit | 816d8d7a668b541cee99469edb90e4917ea11c3e (patch) | |
tree | 84d10ca9173bf499a23de61e577a94639fdaeec2 | |
parent | fa87abe807530daeb46f6730d4231489a4e2782b (diff) | |
download | busybox-w32-816d8d7a668b541cee99469edb90e4917ea11c3e.tar.gz busybox-w32-816d8d7a668b541cee99469edb90e4917ea11c3e.tar.bz2 busybox-w32-816d8d7a668b541cee99469edb90e4917ea11c3e.zip |
setlogcons: open /dev/ttyN for "setlogcons N", not /dev/tty1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | console-tools/setlogcons.c | 10 | ||||
-rwxr-xr-x | examples/var_service/tftpd/run | 2 |
2 files changed, 10 insertions, 2 deletions
diff --git a/console-tools/setlogcons.c b/console-tools/setlogcons.c index 6778a4d2b..0fad6600a 100644 --- a/console-tools/setlogcons.c +++ b/console-tools/setlogcons.c | |||
@@ -41,6 +41,7 @@ | |||
41 | int setlogcons_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 41 | int setlogcons_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
42 | int setlogcons_main(int argc UNUSED_PARAM, char **argv) | 42 | int setlogcons_main(int argc UNUSED_PARAM, char **argv) |
43 | { | 43 | { |
44 | char *devname; | ||
44 | struct { | 45 | struct { |
45 | char fn; | 46 | char fn; |
46 | char subarg; | 47 | char subarg; |
@@ -52,7 +53,14 @@ int setlogcons_main(int argc UNUSED_PARAM, char **argv) | |||
52 | if (argv[1]) | 53 | if (argv[1]) |
53 | arg.subarg = xatou_range(argv[1], 0, 63); | 54 | arg.subarg = xatou_range(argv[1], 0, 63); |
54 | 55 | ||
55 | xioctl(xopen(VC_1, O_RDONLY), TIOCLINUX, &arg); | 56 | /* Can just call it on "/dev/tty1" always, but... |
57 | * in my testing, inactive (never opened) VTs are not | ||
58 | * redirected to, despite ioctl not failing. | ||
59 | * | ||
60 | * By using "/dev/ttyN", ensure it is activated. | ||
61 | */ | ||
62 | devname = xasprintf("/dev/tty%u", arg.subarg); | ||
63 | xioctl(xopen(devname, O_RDONLY), TIOCLINUX, &arg); | ||
56 | 64 | ||
57 | return EXIT_SUCCESS; | 65 | return EXIT_SUCCESS; |
58 | } | 66 | } |
diff --git a/examples/var_service/tftpd/run b/examples/var_service/tftpd/run index e492d8453..ceb2be555 100755 --- a/examples/var_service/tftpd/run +++ b/examples/var_service/tftpd/run | |||
@@ -7,7 +7,7 @@ exec </dev/null | |||
7 | user=root # for bind to port 69 | 7 | user=root # for bind to port 69 |
8 | 8 | ||
9 | exec \ | 9 | exec \ |
10 | env - \ | 10 | env - PATH="$PATH" \ |
11 | softlimit \ | 11 | softlimit \ |
12 | setuidgid "$user" \ | 12 | setuidgid "$user" \ |
13 | udpsvd -v -c 10 -l localhost \ | 13 | udpsvd -v -c 10 -l localhost \ |