summaryrefslogtreecommitdiffstats
path: root/libnetutils/dhcp_utils.c
diff options
context:
space:
mode:
authorDmitry Shmidt <dimitrysh@google.com>2015-03-19 00:43:49 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-03-19 00:43:49 +0000
commit91dbb7eb6aaf777c47d657518777964742f9491a (patch)
tree3fd45508a06f1fd53d6d13e5b2517cef837d33cb /libnetutils/dhcp_utils.c
parent2fe4f9a68df24c0ec1ad1e22223197aa35218990 (diff)
parentc92420b23b3006ed2e1ece6020dc9d6daa7bf336 (diff)
downloadsystem_core-91dbb7eb6aaf777c47d657518777964742f9491a.tar.gz
system_core-91dbb7eb6aaf777c47d657518777964742f9491a.tar.bz2
system_core-91dbb7eb6aaf777c47d657518777964742f9491a.zip
am c92420b2: am d9a65a65: Merge "Improving the time to wait for assigning IP address"
* commit 'c92420b23b3006ed2e1ece6020dc9d6daa7bf336': Improving the time to wait for assigning IP address
Diffstat (limited to 'libnetutils/dhcp_utils.c')
-rw-r--r--libnetutils/dhcp_utils.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libnetutils/dhcp_utils.c b/libnetutils/dhcp_utils.c
index 851d56597..c6b9fe491 100644
--- a/libnetutils/dhcp_utils.c
+++ b/libnetutils/dhcp_utils.c
@@ -72,14 +72,16 @@ static int wait_for_property(const char *name, const char *desired_value, int ma
maxnaps = 1;
}
- while (maxnaps-- > 0) {
- usleep(NAP_TIME * 1000);
+ while (maxnaps-- >= 0) {
if (property_get(name, value, NULL)) {
if (desired_value == NULL ||
strcmp(value, desired_value) == 0) {
return 0;
}
}
+ if (maxnaps >= 0) {
+ usleep(NAP_TIME * 1000);
+ }
}
return -1; /* failure */
}