[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kinit
From:       Oswald Buddenhagen <ossi () kde ! org>
Date:       2010-03-07 13:45:24
Message-ID: 1267969524.032448.8740.nullmailer () svn ! kde ! org
[Download RAW message or body]

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();
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic