]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Add a tiny corner case to the previous commit
authorTilghman Lesher <tilghman@meg.abyt.es>
Tue, 4 May 2010 23:47:08 +0000 (23:47 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Tue, 4 May 2010 23:47:08 +0000 (23:47 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@261094 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/channel.c

index bdcc08a47d4815373134edbd4e2fda1a731c2788..eb8906386cc0e0bcb215d9170d384688dc1c24cf 100644 (file)
@@ -1791,10 +1791,14 @@ struct ast_channel *ast_waitfor_nandfds(struct ast_channel **c, int n, int *fds,
        }
        /* Wait full interval */
        rms = *ms;
-       if (whentohangup && whentohangup < LONG_MAX / 1000) { /* Protect against overflow */
+       /* INT_MAX, not LONG_MAX, because it matters on 64-bit */
+       if (whentohangup && whentohangup < INT_MAX / 1000) { /* Protect against overflow */
                rms = whentohangup * 1000;              /* timeout in milliseconds */
                if (*ms >= 0 && *ms < rms)              /* original *ms still smaller */
                        rms =  *ms;
+       } else if (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,