summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/supervision/s6-svscan.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/supervision/s6-svscan.c b/src/supervision/s6-svscan.c
index c818498..ebf7594 100644
--- a/src/supervision/s6-svscan.c
+++ b/src/supervision/s6-svscan.c
@@ -55,6 +55,15 @@ static unsigned int wantkill = 0 ;
static int cont = 1 ;
static unsigned int consoleholder = 0 ;
+static void restore_console (void)
+{
+ if (consoleholder)
+ {
+ fd_move(2, consoleholder) ;
+ if (fd_copy(1, 2) < 0) strerr_warnwu1sys("restore stdout") ;
+ }
+}
+
static void panicnosp (char const *) gccattr_noreturn ;
static void panicnosp (char const *errmsg)
{
@@ -71,6 +80,7 @@ static void panic (char const *errmsg)
{
int e = errno ;
selfpipe_finish() ;
+ restore_console() ;
errno = e ;
panicnosp(errmsg) ;
}
@@ -565,6 +575,7 @@ int main (int argc, char const *const *argv)
selfpipe_finish() ;
killthem() ;
+ restore_console() ;
reap() ;
}
{