summaryrefslogtreecommitdiff
path: root/server/InterfaceController.cpp
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2017-07-10 19:13:23 +0900
committerLorenzo Colitti <lorenzo@google.com>2017-07-10 19:16:19 +0900
commit516764fbb2b8958cb05da880059201fdef712ed5 (patch)
treedb61c582c6a96ff7a4e902d3b3280faadd9b9d2c /server/InterfaceController.cpp
parent09bf6eb18ffcb58849f6c81fe130ae2d0251a388 (diff)
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
Diffstat (limited to 'server/InterfaceController.cpp')
-rw-r--r--server/InterfaceController.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/server/InterfaceController.cpp b/server/InterfaceController.cpp
index a8b985a8..9b8f64cc 100644
--- a/server/InterfaceController.cpp
+++ b/server/InterfaceController.cpp
@@ -179,12 +179,11 @@ std::string getProperty(const std::string& key, const std::string& dflt) {
};
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");
};