summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Nosek <root@localdomain.pl>2008-03-16 17:26:17 +0100
committerGrzegorz Nosek <root@localdomain.pl>2008-03-16 17:26:17 +0100
commitb233ba1529b6933cdfa732f2c9ef85a8ec834bb8 (patch)
tree1ffaeddc173664dc59fcd80adc4a7a7c30165352
parent105dfa106c36e31b3f62c166cc46b97a6b0f7f51 (diff)
downloadfcgiwrap-b233ba1529b6933cdfa732f2c9ef85a8ec834bb8.tar.xz
fcgiwrap-b233ba1529b6933cdfa732f2c9ef85a8ec834bb8.zip
Use INT_MIN instead of -1 as sentinel in max_va()
-rw-r--r--fcgiwrap.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fcgiwrap.c b/fcgiwrap.c
index 626518f..a2c65b9 100644
--- a/fcgiwrap.c
+++ b/fcgiwrap.c
@@ -10,6 +10,7 @@
#include <errno.h>
#include <string.h>
#include <sys/stat.h>
+#include <limits.h>
#define FCGI_BUF_SIZE 4096
@@ -28,6 +29,8 @@ static int write_all(int fd, char *buf, size_t size)
return size;
}
+#define MAX_VA_SENTINEL INT_MIN
+
static int max_va(int p1, ...)
{
va_list va;
@@ -39,7 +42,7 @@ static int max_va(int p1, ...)
p = va_arg(va, int);
if (p > max)
max = p;
- } while (p >= 0);
+ } while (p != MAX_VA_SENTINEL);
va_end(va);
return max;
@@ -92,7 +95,7 @@ static void fcgi_pass(struct fcgi_context *fc)
char buf[FCGI_BUF_SIZE];
ssize_t nread;
fd_set rset;
- int maxfd = max_va(fc->fd_stdout, fc->fd_stderr, -1);
+ int maxfd = max_va(fc->fd_stdout, fc->fd_stderr, MAX_VA_SENTINEL);
int nready;
const char *err;