BandwidthController: correctly handle the iptables command exit code
The return code from android_fork_execvp() needed to be massaged because
a status ptr was passed in.
Bug: 8185095
Change-Id: I205884f09b563dd729423a74f22fd5b8c2d59c64
diff --git a/BandwidthController.cpp b/BandwidthController.cpp
index 8f3a738..e4171d6 100644
--- a/BandwidthController.cpp
+++ b/BandwidthController.cpp
@@ -198,11 +198,10 @@
argv[argc] = NULL;
res = android_fork_execvp(argc, (char **)argv, &status, false,
failureHandling == IptFailShow);
-
- if ((res || !WIFEXITED(status) || WEXITSTATUS(status)) &&
- failureHandling == IptFailShow) {
- ALOGE("runIptablesCmd(): failed %s res=%d status=%d", fullCmd.c_str(),
- res, status);
+ res = res || !WIFEXITED(status) || WEXITSTATUS(status);
+ if (res && failureHandling == IptFailShow) {
+ ALOGE("runIptablesCmd(): res=%d status=%d failed %s", res, status,
+ fullCmd.c_str());
}
return res;
}