summaryrefslogtreecommitdiff
path: root/server/InterfaceController.cpp
diff options
context:
space:
mode:
authorMaciej Żenczykowski <maze@google.com>2019-10-17 17:18:30 -0700
committerMaciej Żenczykowski <maze@google.com>2019-10-18 00:05:28 -0700
commit28275a8e1aba176768aa9a4e22309dacaa30b887 (patch)
tree93d2fd911a91e5718e8be4138f6245b1faf056a4 /server/InterfaceController.cpp
parent635b3efc58964efb20c7ee801a173b2bddabf50e (diff)
Fix error return propagation in InterfaceController::setCfg()
ifc_add_address return -errno on error Test: builds, atest Bug: 142764715 Signed-off-by: Maciej Żenczykowski <maze@google.com> Change-Id: I6b46e74226538d309ad65ed4ae93817e94bcfb27
Diffstat (limited to 'server/InterfaceController.cpp')
-rw-r--r--server/InterfaceController.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/server/InterfaceController.cpp b/server/InterfaceController.cpp
index 755068d8..7504fb91 100644
--- a/server/InterfaceController.cpp
+++ b/server/InterfaceController.cpp
@@ -55,13 +55,6 @@ using android::netdutils::StatusOr;
using android::netdutils::toString;
using android::netdutils::status::ok;
-#define RETURN_STATUS_IF_IFCERROR(exp) \
- do { \
- if ((exp) == -1) { \
- return statusFromErrno(errno, "Failed to add addr"); \
- } \
- } while (0);
-
namespace {
const char ipv4_proc_path[] = "/proc/sys/net/ipv4/conf";
@@ -506,8 +499,9 @@ Status InterfaceController::setCfg(const InterfaceConfigurationParcel& cfg) {
}
}
- RETURN_STATUS_IF_IFCERROR(
- ifc_add_address(cfg.ifName.c_str(), cfg.ipv4Addr.c_str(), cfg.prefixLength));
+ if (int ret = ifc_add_address(cfg.ifName.c_str(), cfg.ipv4Addr.c_str(), cfg.prefixLength)) {
+ return statusFromErrno(-ret, "Failed to add addr");
+ }
return ok;
}