[Powertop] [PATCH 1/3] fix-warnings: Ignoring return value of system()
Alexandra Yates <alexandra.yates at linux.intel.com>
| Newsgroups | dev.linux.lists.powertop |
|---|---|
| Message-ID | <1402697910-29154-2-git-send-email-alexandra.yates@linux.intel.com> |
Added error handling to system() for bluetooth.cpp.
Signed-off-by: Alexandra Yates <alexandra.yates(a)linux.intel.com>
---
src/tuning/bluetooth.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/tuning/bluetooth.cpp b/src/tuning/bluetooth.cpp
index 2b34277..92f5835 100644
--- a/src/tuning/bluetooth.cpp
+++ b/src/tuning/bluetooth.cpp
@@ -176,10 +176,12 @@ void bt_tunable::toggle(void)
good = good_bad();
if (good == TUNE_GOOD) {
- system("/usr/sbin/hciconfig hci0 up &> /dev/null &");
+ if(!system("/usr/sbin/hciconfig hci0 up &> /dev/null &"))
+ printf("System is not available\n");
return;
}
- system("/usr/sbin/hciconfig hci0 down &> /dev/null");
+ if(!system("/usr/sbin/hciconfig hci0 down &> /dev/null"))
+ printf("System is not available\n");
}
const char *bt_tunable::toggle_script(void)
--
1.7.9.5