From kde-commits Sun Mar 07 13:45:24 2010 From: Oswald Buddenhagen Date: Sun, 07 Mar 2010 13:45:24 +0000 To: kde-commits Subject: KDE/kdelibs/kinit Message-Id: <1267969524.032448.8740.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=126796953507028 SVN commit 1100408 by ossi: redirect stdout to stderr if we are forked from a command line tool (say, ktraderclient) which is used in a pipe, us keeping open the inherited stdout is pretty fatal for the usefulness of the pipe. as we have no use for a real stdout (if any at all), just redirect it to stderr. we can't just close/redirect stderr, as this is where all "interesting" output is going. so if somebody tries to use some tool's stderr in a pipe, he'd still be out of luck. BUG: 201714 M +4 -0 kinit.cpp --- trunk/KDE/kdelibs/kinit/kinit.cpp #1100407:1100408 @@ -1671,6 +1671,10 @@ cleanup_fds(); + // Redirect stdout to stderr. We have no reason to use stdout anyway. + // This minimizes our impact on commands used in pipes. + (void)dup2(2, 1); + if (do_fork) { #ifdef Q_WS_MACX mac_fork_and_reexec_self();