From 5ae702339e6e2e6a4921aad4dd923f5d20492a53 Mon Sep 17 00:00:00 2001
From: Roy Marples <roy@marples.name>
Date: Tue, 6 May 2008 16:21:16 +0000
Subject: We don't need to handle SIGWINCH in sysinit, so this should fix
 loading a framebuffer module in init.sh (Gentoo #219929. Ideally someone
 should tell me why this is happening and if there is a better fix.

---
 src/rc/rc.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

(limited to 'src')

diff --git a/src/rc/rc.c b/src/rc/rc.c
index 94292870..c1bc97e8 100644
--- a/src/rc/rc.c
+++ b/src/rc/rc.c
@@ -146,7 +146,7 @@ static void cleanup(void)
 		rc_plugin_unload();
 
 		if (! rc_in_plugin && termios_orig) {
-			tcsetattr(fileno(stdin), TCSANOW, termios_orig);
+			tcsetattr(STDIN_FILENO, TCSANOW, termios_orig);
 			free(termios_orig);
 		}
 
@@ -215,7 +215,7 @@ static char read_key(bool block)
 {
 	struct termios termios;
 	char c = 0;
-	int fd = fileno(stdin);
+	int fd = STDIN_FILENO;
 
 	if (! isatty(fd))
 		return false;
@@ -308,7 +308,7 @@ static void run_program(const char *prog)
 		sigprocmask(SIG_SETMASK, &old, NULL);
 
 		if (termios_orig)
-			tcsetattr(fileno(stdin), TCSANOW, termios_orig);
+			tcsetattr(STDIN_FILENO, TCSANOW, termios_orig);
 
 		execl(prog, prog, (char *) NULL);
 		eerror("%s: unable to exec `%s': %s", applet, prog,
@@ -614,7 +614,7 @@ static void do_coldplug(void)
 	if (coldplugged_services)
 		TAILQ_FOREACH(s, coldplugged_services, entries)
 			printf(" %s", s->value);
-	printf ("%s\n", ecolor(ECOLOR_NORMAL));
+	printf("%s\n", ecolor(ECOLOR_NORMAL));
 }
 
 static void do_newlevel(const char *newlevel)
@@ -635,6 +635,13 @@ static void do_newlevel(const char *newlevel)
 	{
 		/* OK, we're either in runlevel 1 or single user mode */
 
+		/* We don't want to trap SIGWINCH here as when a framebuffer
+		 * driver is loaded by udev and we start using it then we
+		 * race for some reason with the below scripts.
+		 * This is fine as we only really need SIGWINCH for tidy
+		 * output when using the logger. */
+		signal_setup(SIGWINCH, SIG_DFL);
+
 		/* exec init-early.sh if it exists
 		 * This should just setup the console to use the correct
 		 * font. Maybe it should setup the keyboard too? */
-- 
cgit v1.2.3