diff options
author | Dmitry Shmidt <dimitrysh@google.com> | 2015-03-19 00:43:49 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-03-19 00:43:49 +0000 |
commit | 91dbb7eb6aaf777c47d657518777964742f9491a (patch) | |
tree | 3fd45508a06f1fd53d6d13e5b2517cef837d33cb /libnetutils | |
parent | 2fe4f9a68df24c0ec1ad1e22223197aa35218990 (diff) | |
parent | c92420b23b3006ed2e1ece6020dc9d6daa7bf336 (diff) | |
download | system_core-91dbb7eb6aaf777c47d657518777964742f9491a.zip system_core-91dbb7eb6aaf777c47d657518777964742f9491a.tar.gz system_core-91dbb7eb6aaf777c47d657518777964742f9491a.tar.bz2 |
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')
-rw-r--r-- | libnetutils/dhcp_utils.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libnetutils/dhcp_utils.c b/libnetutils/dhcp_utils.c index 851d565..c6b9fe4 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 */ } |