AP_HAL_Linux: check return value of system command

Compilation fails on disco without this patch as system is declared with
attribute warn_unused_result
This commit is contained in:
Peter Barker 2019-08-19 09:46:02 +10:00 committed by Andrew Tridgell
parent 5f2dd57cca
commit 914e6c5497
1 changed files with 4 additions and 1 deletions

View File

@ -287,7 +287,10 @@ void GPIO_Sysfs::_gpio_script_thread(void)
char cmd[100];
snprintf(cmd, sizeof(cmd)-1, "/bin/sh %s %u %u", HAL_GPIO_SCRIPT, pv.pin, pv.value);
hal.console->printf("Running: %s\n", cmd);
system(cmd);
const int system_ret = system(cmd);
if (system_ret != 0) {
hal.console->printf("Unexpected return value (%d)\n", system_ret);
}
}
}
}