<div dir="ltr"><div>Greetings, sent this last week but didn't get any feedback.<br><br></div>Is this change acceptable for systemd or is there a particular reason for not starting gettys on all active consoles?<br><div class="gmail_extra">
<br><br><div class="gmail_quote">On Fri, Aug 16, 2013 at 8:28 PM, Michael Marineau <span dir="ltr"><<a href="mailto:michael.marineau@coreos.com" target="_blank">michael.marineau@coreos.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
This enables a getty on active kernel consoles even when they are not<br>
the last one specified on the kernel command line and mapped to<br>
/dev/console. Now the order "console=ttyS0 console=tty0" works in<br>
addition to "console=tty0 console=ttyS0".<br>
---<br>
<br>
I'm not sure if there is a particular reason for the more limited existing<br>
behavior but it took me by surprise.<br>
<br>
src/getty-generator/getty-generator.c | 37 ++++++++++++++++++++++-------------<br>
1 file changed, 23 insertions(+), 14 deletions(-)<br>
<br>
diff --git a/src/getty-generator/getty-generator.c b/src/getty-generator/getty-generator.c<br>
index 4b7a60a..6c93806 100644<br>
--- a/src/getty-generator/getty-generator.c<br>
+++ b/src/getty-generator/getty-generator.c<br>
@@ -122,33 +122,42 @@ int main(int argc, char *argv[]) {<br>
}<br>
<br>
if (read_one_line_file("/sys/class/tty/console/active", &active) >= 0) {<br>
- const char *tty;<br>
-<br>
- tty = strrchr(active, ' ');<br>
- if (tty)<br>
- tty ++;<br>
- else<br>
- tty = active;<br>
-<br>
- /* Automatically add in a serial getty on the kernel<br>
- * console */<br>
- if (isempty(tty) || tty_is_vc(tty))<br>
- free(active);<br>
- else {<br>
+ char *w, *state;<br>
+ size_t l;<br>
+<br>
+ /* Automatically add in a serial getty on all active<br>
+ * kernel consoles */<br>
+ FOREACH_WORD(w, l, active, state) {<br>
+ char *tty;<br>
int k;<br>
<br>
+ tty = strndup(w, l);<br>
+ if (!tty) {<br>
+ log_oom();<br>
+ free(active);<br>
+ r = EXIT_FAILURE;<br>
+ goto finish;<br>
+ }<br>
+<br>
+ if (isempty(tty) || tty_is_vc(tty)) {<br>
+ free(tty);<br>
+ continue;<br>
+ }<br>
+<br>
/* We assume that gettys on virtual terminals are<br>
* started via manual configuration and do this magic<br>
* only for non-VC terminals. */<br>
<br>
k = add_serial_getty(tty);<br>
- free(active);<br>
<br>
if (k < 0) {<br>
+ free(tty);<br>
+ free(active);<br>
r = EXIT_FAILURE;<br>
goto finish;<br>
}<br>
}<br>
+ free(active);<br>
}<br>
<br>
/* Automatically add in a serial getty on the first<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.8.1.5<br>
<br>
</font></span></blockquote></div><br></div></div>