diff options
Diffstat (limited to 'main/channel.c')
-rw-r--r-- | main/channel.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/main/channel.c b/main/channel.c index 4d1efab6e..d201510ad 100644 --- a/main/channel.c +++ b/main/channel.c @@ -2095,10 +2095,15 @@ struct ast_channel *ast_waitfor_nandfds(struct ast_channel **c, int n, int *fds, } /* Wait full interval */ rms = *ms; - if (!ast_tvzero(whentohangup)) { + /* INT_MAX, not LONG_MAX, because it matters on 64-bit */ + if (!ast_tvzero(whentohangup) && whentohangup.tv_sec < INT_MAX / 1000) { rms = whentohangup.tv_sec * 1000 + whentohangup.tv_usec / 1000; /* timeout in milliseconds */ - if (*ms >= 0 && *ms < rms) /* original *ms still smaller */ + if (*ms >= 0 && *ms < rms) { /* original *ms still smaller */ rms = *ms; + } + } else if (!ast_tvzero(whentohangup) && rms < 0) { + /* Tiny corner case... call would need to last >24 days */ + rms = INT_MAX; } /* * Build the pollfd array, putting the channels' fds first, |