Francois Gouget : winegcc: Ignore the test link command stdout and stderr messages.

Alexandre Julliard julliard at winehq.org
Fri Sep 6 12:39:52 CDT 2013


Module: wine
Branch: master
Commit: 7d3f6d4c60a33100c879f68746182334f0f49ce0
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=7d3f6d4c60a33100c879f68746182334f0f49ce0

Author: Francois Gouget <fgouget at free.fr>
Date:   Fri Sep  6 14:33:24 2013 +0200

winegcc: Ignore the test link command stdout and stderr messages.

Otherwise invoking winegcc on any platform where our first guess at
the link options fails results in a lot of confusing error messages.

---

 tools/winegcc/winegcc.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c
index 5cac73d..273210a 100644
--- a/tools/winegcc/winegcc.c
+++ b/tools/winegcc/winegcc.c
@@ -334,7 +334,9 @@ static int try_link( const strarray *prefix, const strarray *link_tool, const ch
 {
     const char *in = get_temp_file( "try_link", ".c" );
     const char *out = get_temp_file( "try_link", ".out" );
+    const char *err = get_temp_file( "try_link", ".err" );
     strarray *link = strarray_dup( link_tool );
+    int sout = -1, serr = -1;
     int ret;
 
     create_file( in, 0644, "int main(void){return 1;}\n" );
@@ -344,7 +346,21 @@ static int try_link( const strarray *prefix, const strarray *link_tool, const ch
     strarray_addall( link, strarray_fromstring( cflags, " " ) );
     strarray_add( link, in );
 
+    sout = dup( fileno(stdout) );
+    freopen( err, "w", stdout );
+    serr = dup( fileno(stderr) );
+    freopen( err, "w", stderr );
     ret = spawn( prefix, link, 1 );
+    if (sout >= 0)
+    {
+        dup2( sout, fileno(stdout) );
+        close( sout );
+    }
+    if (serr >= 0)
+    {
+        dup2( serr, fileno(stderr) );
+        close( serr );
+    }
     strarray_free( link );
     return ret;
 }




More information about the wine-cvs mailing list