From: Yang Tse Date: Mon, 10 Dec 2012 15:12:49 +0000 (+0100) Subject: ares_timeout.c: fix compiler warning X-Git-Tag: upstream/1.10.0~74 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fupstream%2Fc-ares.git;a=commitdiff_plain;h=98b52964cf0abf92dcaf71c203ff27af8a70a423 ares_timeout.c: fix compiler warning --- diff --git a/ares_timeout.c b/ares_timeout.c index 738ad15..1dc0283 100644 --- a/ares_timeout.c +++ b/ares_timeout.c @@ -16,6 +16,9 @@ #include "ares_setup.h" +#ifdef HAVE_LIMITS_H +#include +#endif #ifdef HAVE_SYS_TIME_H #include #endif @@ -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)) {