loader: actually set serial flag when using serial console
In F15 and earlier, if the primary console was a serial port, loader
would set the appropriate flag (LOADER_FLAGS_SERIAL). This got dropped
accidentally in the refactoring work after F15 (see commit 7605892).
This will correctly set the flag (and thus force text mode) if
init_serial() indicates that a serial console is being used.
---
loader/loader.c | 3 ++-
loader/serial.c | 8 ++++++--
loader/serial.h | 2 +-
3 files changed, 9 insertions(+), 4 deletions(-)
-void init_serial(struct termios *orig_cmode, int *orig_flags, GHashTable *cmdline) {
+int init_serial(struct termios *orig_cmode, int *orig_flags, GHashTable *cmdline) {
#if !defined(__s390__) && !defined(__s390x__)
- int fd;
+ int fd, serial;
/* We need to get the original mode and flags here (in addition to inside
* get_serial) so we'll have them for later when we restore the console
@@ -163,6 +163,7 @@ void init_serial(struct termios *orig_cmode, int *orig_flags, GHashTable *cmdlin
if (!serial_requested(cmdline) || (fd = get_serial_fd()) == -1) {
/* This is not a serial console install. */
+ serial = 0;
if ((fd = open("/dev/tty1", O_RDWR, 0)) < 0) {
if ((fd = open("/dev/vc/1", O_RDWR, 0)) < 0) {
fprintf(stderr, "failed to open /dev/tty1 and /dev/vc/1");
@@ -171,6 +172,7 @@ void init_serial(struct termios *orig_cmode, int *orig_flags, GHashTable *cmdlin
}
}
else {
+ serial = 1;
struct winsize winsize;