From: lace <> Date: Tue, 10 Jul 2007 21:43:43 +0000 (+0000) Subject: Workaround a readline deadlock bug in _get_tty_settings(). X-Git-Url: https://git.jankratochvil.net/?p=nethome.git;a=commitdiff_plain;h=f4cf3400508a136e366e2ce3dde132f5b1be7ac2 Workaround a readline deadlock bug in _get_tty_settings(). --- diff --git a/src/orphanripper.c b/src/orphanripper.c index 0615aa4..cf3039f 100644 --- a/src/orphanripper.c +++ b/src/orphanripper.c @@ -87,6 +87,10 @@ static int spawn (char **argv) /* With TERMP passed as NULL we get "\n" -> "\r\n". */ cfmakeraw (&termios); +#ifdef FLUSHO + /* Workaround a readline deadlock bug in _get_tty_settings(). */ + termios.c_lflag &= ~FLUSHO; +#endif child = forkpty (&amaster, childptyname, &termios, NULL); switch (child) { @@ -98,6 +102,15 @@ static int spawn (char **argv) assert (i == 0); i = close (pipefd[1]); assert (i == 0); + + /* Do not replace STDIN as inferiors query its termios. */ +#if 0 + i = close (STDIN_FILENO); + assert (i == 0); + i = open ("/dev/null", O_RDONLY); + assert (i == STDIN_FILENO); +#endif + /* Do not setpgrp(2) in the parent process as the process-group is shared for the whole sh(1) pipeline we could be a part of. The process-group is set according to PID of the first