Skip to content

Commit

Permalink
ares_timeout.c: fix compiler warning
Browse files Browse the repository at this point in the history
  • Loading branch information
yangtse committed Dec 10, 2012
1 parent 93a09ea commit 98b5296
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ares_timeout.c
Expand Up @@ -16,6 +16,9 @@

#include "ares_setup.h"

#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
Expand Down Expand Up @@ -67,8 +70,10 @@ struct timeval *ares_timeout(ares_channel channel, struct timeval *maxtv,
*/
if (min_offset != -1)
{
nextstop.tv_sec = min_offset/1000;
nextstop.tv_usec = (min_offset%1000)*1000;
int ioffset = (min_offset > (long)INT_MAX) ? INT_MAX : (int)min_offset;

nextstop.tv_sec = ioffset/1000;
nextstop.tv_usec = (ioffset%1000)*1000;

if (!maxtv || ares__timedout(maxtv, &nextstop))
{
Expand Down

0 comments on commit 98b5296

Please sign in to comment.