[OpenWrt-Devel] [PATCH procd 4/8] Fix scroll lock blocking procd

Michel Stam m.stam at fugro.nl
Thu Oct 2 08:56:19 EDT 2014


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 at fugro.nl>
---
 procd.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/procd.c b/procd.c
index 6ec7cd0..32febd6 100644
--- a/procd.c
+++ b/procd.c
@@ -16,6 +16,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 
+#include <fcntl.h>
 #include <unistd.h>
 #include <getopt.h>
 #include <libgen.h>
@@ -61,6 +62,7 @@ int main(int argc, char **argv)
 			return usage(argv[0]);
 		}
 	}
+	fcntl(STDERR_FILENO, F_SETFL, fcntl(STDERR_FILENO, F_GETFL) | O_NONBLOCK);
 	uloop_init();
 	uloop_release_sigint();
 	procd_signal();
-- 
1.7.12.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list