udhcpc: make sure we do not overflow poll timeout
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
94dcfd8cc0
commit
7c67f1e9ab
@ -1085,7 +1085,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
if (tv > 0) {
|
if (tv > 0) {
|
||||||
log1("waiting on select %u seconds", tv);
|
log1("waiting on select %u seconds", tv);
|
||||||
timestamp_before_wait = (unsigned)monotonic_sec();
|
timestamp_before_wait = (unsigned)monotonic_sec();
|
||||||
retval = poll(pfds, 2, tv * 1000);
|
retval = poll(pfds, 2, tv < INT_MAX/1000 ? tv * 1000 : INT_MAX);
|
||||||
if (retval < 0) {
|
if (retval < 0) {
|
||||||
/* EINTR? A signal was caught, don't panic */
|
/* EINTR? A signal was caught, don't panic */
|
||||||
if (errno == EINTR) {
|
if (errno == EINTR) {
|
||||||
|
@ -1453,7 +1453,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
if (tv > 0) {
|
if (tv > 0) {
|
||||||
log1("waiting on select %u seconds", tv);
|
log1("waiting on select %u seconds", tv);
|
||||||
timestamp_before_wait = (unsigned)monotonic_sec();
|
timestamp_before_wait = (unsigned)monotonic_sec();
|
||||||
retval = poll(pfds, 2, tv * 1000);
|
retval = poll(pfds, 2, tv < INT_MAX/1000 ? tv * 1000 : INT_MAX);
|
||||||
if (retval < 0) {
|
if (retval < 0) {
|
||||||
/* EINTR? A signal was caught, don't panic */
|
/* EINTR? A signal was caught, don't panic */
|
||||||
if (errno == EINTR) {
|
if (errno == EINTR) {
|
||||||
|
Loading…
Reference in New Issue
Block a user