← Commit list

816d8d7a6

Denys Vlasenko
Denys Vlasenko
2018-04-16
SUCCESS Duration: 144s

Subject

setlogcons: open /dev/ttyN for "setlogcons N", not /dev/tty1

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

console-tools/setlogcons.c+9 -1
@@ -41,6 +41,7 @@
int setlogcons_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int setlogcons_main(int argc UNUSED_PARAM, char **argv)
{
+ char *devname;
struct {
char fn;
char subarg;
@@ -52,7 +53,14 @@ int setlogcons_main(int argc UNUSED_PARAM, char **argv)
if (argv[1])
arg.subarg = xatou_range(argv[1], 0, 63);
- xioctl(xopen(VC_1, O_RDONLY), TIOCLINUX, &arg);
+ /* Can just call it on "/dev/tty1" always, but...
+ * in my testing, inactive (never opened) VTs are not
+ * redirected to, despite ioctl not failing.
+ *
+ * By using "/dev/ttyN", ensure it is activated.
+ */
+ devname = xasprintf("/dev/tty%u", arg.subarg);
+ xioctl(xopen(devname, O_RDONLY), TIOCLINUX, &arg);
return EXIT_SUCCESS;
}
examples/var_service/tftpd/run+1 -1
@@ -7,7 +7,7 @@ exec </dev/null
user=root # for bind to port 69
exec \
-env - \
+env - PATH="$PATH" \
softlimit \
setuidgid "$user" \
udpsvd -v -c 10 -l localhost \