fix system() return value handling

Change-Id: I3f12d4ce0653b31ca397167a40303b764bdf7472
Reviewed-by: Sergio Ahumada <sahumada@blackberry.com>