From 3aff594bcaf7378fe2e174a3e99483f7cb7c7188 Mon Sep 17 00:00:00 2001
From: Arwed von Merkatz <v.merkatz@gmx.net>
Date: Wed, 28 Feb 2007 22:27:32 +0100
Subject: [PATCH 04/23] simpleinit: Fix display of messages on shutdown

Fix stdio handling in the process_command function. This was missed in the
stdio handling patch ("Fix stdio handling", 2006-04-24).

Ref: https://bugs.sourcemage.org/show_bug.cgi?id=13114
[ismael@sourcemage.org: Added proper commit message]

Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
---
 login-utils/simpleinit.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/login-utils/simpleinit.c b/login-utils/simpleinit.c
index 4d0b4111aa4a..34a31d4a420c 100644
--- a/login-utils/simpleinit.c
+++ b/login-utils/simpleinit.c
@@ -1497,6 +1497,9 @@ static void process_command (unsigned command,const struct command_struct *comda
 		for (ival = 1; ival < NSIG; ival++) signal (ival, SIG_DFL);
 		sigprocmask(SIG_UNBLOCK,&all_signals,NULL);
 		if (!userspace){
+			close (0);
+			close (1);
+			close (2);
 			open ("/dev/console", O_RDONLY, 0);
 			open ("/dev/console", O_RDWR, 0);
 			dup2 (1, 2);
-- 
2.44.0

