Fix scroll lock blocking procd
authorJohn Crispin <blogic@openwrt.org>
Mon, 6 Oct 2014 18:13:28 +0000 (20:13 +0200)
committerJohn Crispin <blogic@openwrt.org>
Mon, 6 Oct 2014 18:53:55 +0000 (20:53 +0200)
On x86, pressing the scrolllock button may effectively prevent procd from rebooting
the system. This happens because procd tries to write to /dev/console, which in that
situation is blocked, effectively blocking procd from rebooting the system.

This patch puts procd's stderr access into non-blocking, which will prevent the
boot from being stuck.

Signed-off-by: Michel Stam <m.stam@fugro.nl>
initd/early.c

index 77ced77..a9f6afb 100644 (file)
@@ -72,6 +72,8 @@ early_console(const char *dev)
            dd != STDOUT_FILENO &&
            dd != STDERR_FILENO)
                close(dd);
+
+       fcntl(STDERR_FILENO, F_SETFL, fcntl(STDERR_FILENO, F_GETFL) | O_NONBLOCK);
 }
 
 static void