From a40ed1fb156a89b7bad3b886dc66ffc7adf2219f Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 29 Jan 2015 17:22:38 +0100 Subject: RemoteServer: Make sure we don't write to stderr In adminauthorization_x11.cpp we redirect stderr of the child process to a pipe, but do not read from it anymore after sudo completed. Which means, if the server process continues to write into the pipe it'll block at some point. Avoid this by always closing the stderr handle in production mode. Change-Id: If1e9578f12d7a0f60811f9c2b43cd9c18adfea59 Reviewed-by: Niels Weber Reviewed-by: Karsten Heimrich --- src/libs/installer/remoteserver.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libs/installer/remoteserver.cpp b/src/libs/installer/remoteserver.cpp index eeab37c6e..185466ccd 100644 --- a/src/libs/installer/remoteserver.cpp +++ b/src/libs/installer/remoteserver.cpp @@ -71,6 +71,14 @@ void RemoteServer::start() if (d->m_tcpServer) return; +#if defined(Q_OS_UNIX) && !defined(Q_OS_OSX) + // avoid writing to stderr: + // the parent process has redirected stderr to a pipe to work with sudo, + // but is not reading anymore -> writing to stderr will block after a while. + if (d->m_mode == Protocol::Mode::Production) + fclose(stderr); +#endif + d->m_tcpServer = new TcpServer(d->m_port, d->m_key); d->m_tcpServer->moveToThread(&d->m_thread); connect(&d->m_thread, SIGNAL(finished()), d->m_tcpServer, SLOT(deleteLater())); -- cgit v1.2.3