in reply to
Re^2: System call + signals = bad return code?
in thread System call + signals = bad return code?
I was confused by your example. Sorry. This statement though still holds: I've seen similar cases where system returns an invalid result if I've already forked off an unrelated process and it happens to die when system() is executing. (i.e. in addition to signals, process reaping is problematic). You may want to try replacing system() with fork/exec/waitpid. The waitpid will return the status for the child pid you pass to it.