File FastCGI-clientdata_pointer.patch of Package FastCGI.3897
--- cgi-fcgi/cgi-fcgi.c
+++ cgi-fcgi/cgi-fcgi.c
@@ -21,6 +21,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/types.h>
#include "fcgi_config.h"
@@ -145,7 +146,7 @@
static int bytesToRead; /* number of bytes to read from Web Server */
-static int appServerSock = -1; /* Socket connected to FastCGI application,
+static size_t appServerSock = -1; /* Socket connected to FastCGI application,
* used by AppServerReadHandler and
* AppServerWriteHandler. */
static Buffer fromAS; /* Bytes read from the FCGI application server. */
@@ -640,7 +641,7 @@
}
if((av[ac] = (char *)malloc(strlen(tp1)+1)) == NULL) {
fprintf(stderr, "Cannot allocate %d bytes\n",
- strlen(tp1)+1);
+ (int)strlen(tp1)+1);
exit(-1);
}
strcpy(av[ac++], tp1);
--- examples/threaded.c
+++ examples/threaded.c
@@ -24,7 +24,7 @@
static void *doit(void *a)
{
- int rc, i, thread_id = (int)a;
+ size_t rc, i, thread_id = (size_t)a;
pid_t pid = getpid();
FCGX_Request request;
char *server_name;
@@ -53,7 +53,7 @@
"<h1>FastCGI Hello! (multi-threaded C, fcgiapp library)</h1>"
"Thread %d, Process %ld<p>"
"Request counts for %d threads running on host <i>%s</i><p><code>",
- thread_id, pid, THREAD_COUNT, server_name ? server_name : "?");
+ (int)thread_id, pid, THREAD_COUNT, server_name ? server_name : "?");
sleep(2);
@@ -71,7 +71,7 @@
int main(void)
{
- int i;
+ size_t i;
pthread_t id[THREAD_COUNT];
FCGX_Init();
--- include/fcgios.h
+++ include/fcgios.h
@@ -93,7 +93,7 @@
# if defined(__STDC__) || defined(__cplusplus)
typedef void *ClientData;
# else
- typedef int *ClientData;
+ typedef size_t *ClientData;
# endif /* __STDC__ */
#define _CLIENTDATA
#endif
--- libfcgi/os_unix.c
+++ libfcgi/os_unix.c
@@ -1155,7 +1155,7 @@
for (;;) {
do {
-#ifdef HAVE_SOCKLEN
+#ifdef HAVE_SYS_SOCKET_H
socklen_t len = sizeof(sa);
#else
int len = sizeof(sa);
@@ -1255,7 +1255,7 @@
struct sockaddr_in in;
struct sockaddr_un un;
} sa;
-#ifdef HAVE_SOCKLEN
+#ifdef HAVE_SYS_SOCKET_H
socklen_t len = sizeof(sa);
#else
int len = sizeof(sa);