Always return a meaningful error from setIpv6AddrGenMode.
SetProperty does not always set errno to a meaningful value. This
is confusing, particularly in the case where the errno happens to
be set to EOPNOTSUPP: in that case IpManager will interpret the
error as being "kernel does not support stable privacy addresses"
and continue, instead of failing as it should.
Bug: 17613910
Test: bullhead builds, boots, connects to wifi
Change-Id: I058f5fe2dd1085036d669d89a4cac0b3b0c0949c
diff --git a/server/InterfaceController.cpp b/server/InterfaceController.cpp
index a8b985a..9b8f64c 100644
--- a/server/InterfaceController.cpp
+++ b/server/InterfaceController.cpp
@@ -179,12 +179,11 @@
};
Status setProperty(const std::string& key, const std::string& val) {
- // SetProperty tries to encode something useful in errno, however
- // the value may get clobbered by async_safe_format_log() in
- // __system_property_set(). Use with care.
+ // SetProperty does not dependably set errno to a meaningful value. Use our own error code so
+ // callers don't get confused.
return android::base::SetProperty(key, val)
? ok
- : statusFromErrno(errno, "SetProperty failed");
+ : statusFromErrno(EREMOTEIO, "SetProperty failed, see libc logs");
};