From: Sebastian Harl Date: Mon, 21 Oct 2013 06:59:03 +0000 (+0200) Subject: utils channel: Normalize time before passing it to phtread_cond_timedwait. X-Git-Tag: sysdb-0.1.0~336^2~47 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=bed406a8fce9eb683059a3138dd33e4cf7bd71cd;p=sysdb.git utils channel: Normalize time before passing it to phtread_cond_timedwait. --- diff --git a/src/utils/channel.c b/src/utils/channel.c index af41b47..8e55ae5 100644 --- a/src/utils/channel.c +++ b/src/utils/channel.c @@ -210,6 +210,11 @@ sdb_channel_select(sdb_channel_t *chan, int *wantread, void *read_data, abstime.tv_sec += timeout->tv_sec; abstime.tv_nsec += timeout->tv_nsec; + if (abstime.tv_nsec > 1000000000) { + abstime.tv_nsec -= 1000000000; + abstime.tv_sec += 1; + } + status = pthread_cond_timedwait(&chan->cond, &chan->lock, &abstime); }