From: Julian Seward Date: Thu, 3 Jun 2010 20:27:19 +0000 (+0000) Subject: on MacOSX, correctly propagate failure code of system() call. X-Git-Tag: svn/VALGRIND_3_6_0~279 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fac69dba30a8d0768322796b21a9c5979bcaf55b;p=thirdparty%2Fvalgrind.git on MacOSX, correctly propagate failure code of system() call. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11147 --- 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; }