From 2be18a9c27e5e47d48d051de6d6a4444e4b29b43 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Wed, 5 Jan 2011 09:28:47 +0000 Subject: [PATCH] 2011-01-05 10:28 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/src/rtl/hbproces.c ! fixed hb_fsProcessExec() in DOS, OS2 and WinCE builds and hb_fsProcessOpen() in OS2 builds to close handles open for stdin, stdout and stderr communication --- harbour/ChangeLog | 6 ++++++ harbour/src/rtl/hbproces.c | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 52cb062b39..8c6b9b106a 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,12 @@ The license applies to all entries newer than 2009-04-28. */ +2011-01-05 10:28 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/src/rtl/hbproces.c + ! fixed hb_fsProcessExec() in DOS, OS2 and WinCE builds and + hb_fsProcessOpen() in OS2 builds to close handles open for + stdin, stdout and stderr communication + 2011-01-04 16:57 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbxbp/hbxbp.hbx ! Auto-generated. diff --git a/harbour/src/rtl/hbproces.c b/harbour/src/rtl/hbproces.c index e54e6b835c..10c5e54d27 100644 --- a/harbour/src/rtl/hbproces.c +++ b/harbour/src/rtl/hbproces.c @@ -355,11 +355,20 @@ static int hb_fsProcessExec( const char * pszFilename, hb_fsSetIOError( iResult >= 0, 0 ); if( iStdIn != FS_ERROR ) + { dup2( iStdIn, 0 ); + close( iStdIn ); + } if( iStdOut != FS_ERROR ) + { dup2( iStdOut, 1 ); + close( iStdOut ); + } if( iStdErr != FS_ERROR ) + { dup2( iStdErr, 2 ); + close( iStdErr ); + } hb_vmLock(); hb_freeArgs( argv ); @@ -729,8 +738,13 @@ HB_FHANDLE hb_fsProcessOpen( const char * pszFilename, hb_freeArgs( argv ); dup2( hStdIn, 0 ); + close( hStdIn ); + dup2( hStdOut, 1 ); + close( hStdOut ); + dup2( hStdErr, 2 ); + close( hStdErr ); if( pid < 0 ) fError = HB_TRUE;