summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorKen Chen <cken@google.com>2023-01-30 18:01:56 +0800
committerKen Chen <cken@google.com>2023-01-30 18:40:44 +0800
commit26bc3d1abaa7c61e921f50d0a3894b89b7e0db68 (patch)
treefe1b1aafcf0ba06bd511b5c01d9e5bdd9df9b0ee /server
parentfd22f385a7817bc55a1bac4e022e7c00716095bf (diff)
downloadnetd-26bc3d1abaa7c61e921f50d0a3894b89b7e0db68.tar.gz
Code Health: Reduce nesting
A follow-up commit of aosp/2389516. Bug: 265503240 Bug: 263219497 Test: atest Change-Id: I3e646f646508f1f6077d2b20d49f2c40887fca2d
Diffstat (limited to 'server')
-rw-r--r--server/NetworkController.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/server/NetworkController.cpp b/server/NetworkController.cpp
index 3e38d48e..e61ee306 100644
--- a/server/NetworkController.cpp
+++ b/server/NetworkController.cpp
@@ -827,11 +827,10 @@ bool NetworkController::isUidAllowed(unsigned netId, uid_t uid) const {
Network* network = getNetworkLocked(netId);
// Exempt when no netId is specified and there is no default network, so that apps or tests can
// do DNS lookups for hostnames in etc/hosts.
- if ((network && network->isUidAllowed(uid)) ||
- (netId == NETID_UNSET && mDefaultNetId == NETID_UNSET)) {
+ if (netId == NETID_UNSET && mDefaultNetId == NETID_UNSET) {
return true;
}
- return false;
+ return network && network->isUidAllowed(uid);
}
bool NetworkController::isValidNetworkLocked(unsigned netId) const {