From fac69dba30a8d0768322796b21a9c5979bcaf55b Mon Sep 17 00:00:00 2001 From: Julian Seward Date: Thu, 3 Jun 2010 20:27:19 +0000 Subject: [PATCH] on MacOSX, correctly propagate failure code of system() call. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11147 --- coregrind/link_tool_exe.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/coregrind/link_tool_exe.c b/coregrind/link_tool_exe.c index cb01372e99..811e462789 100644 --- a/coregrind/link_tool_exe.c +++ b/coregrind/link_tool_exe.c @@ -113,7 +113,7 @@ int main ( int argc, char** argv ) return failed ? 1 : 0; } -/* ------------------------- LINUX ------------------------- */ +/* ------------------------- DARWIN ------------------------ */ #elif defined(VGO_darwin) @@ -129,8 +129,9 @@ int main ( int argc, char** argv ) int main ( int argc, char** argv ) { - int i; - size_t reqd = 0; + int i; + int/*bool*/ failed = 0; + size_t reqd = 0; // expect at least: alt-load-address gcc -o foo bar.o assert(argc > 5); @@ -165,13 +166,13 @@ int main ( int argc, char** argv ) if (0) printf("\n"); int r = system(cmd); + if (r == -1 || WEXITSTATUS(r) != 0) + failed = 1; free(cmd); - // return the result of system. Note, we should handle it - // properly; that would involve using WEXITSTATUS on the - // value system gives back to us. - return r; + // return the result of system. + return failed ? 1 : 0; } -- 2.47.2