Linux fixes for mod_fastcgi.c
Andrew Kuchling (amk@magnet.com)
Tue, 4 Jun 1996 19:27:07 -0400 (EDT)
From: Andrew Kuchling <amk@magnet.com>
Message-Id: <199606042327.TAA17708@lemur.magnet.com>
Subject: Linux fixes for mod_fastcgi.c
To: fastcgi-developers@openmarket.com
Date: Tue, 4 Jun 1996 19:27:07 -0400 (EDT)
The appended patch seems to make mod_fastcgi.c 1.2 work with
Apache 1.0.5 on Linux.
One thing I noticed that may be a bug waiting to happen, in FastCgiHandler():
{
FastCgiServerInfo *serverInfoPtr;
FastCgiInfo *infoPtr;
int longjmp_val;
OS_IpcAddr *ipcAddrPtr;
longjmp_val = setjmp(jmp_env);
if (longjmp_val == FCGI_ERROR) {
if (infoPtr)
FcgiCleanUp(infoPtr);
return SERVER_ERROR;
}
Shouldn't infoPtr be initialized to NULL? What if setjmp()
fails and infoPtr contains some non-NULL garbage value?
Also, if there are no AppClass directives in srm.conf, Apache
segfaults in free() on trying to access a FastCGI script; I'm still
searching for the cause of this.
Andrew Kuchling
amk@magnet.com
--- mod_fastcgi.c 1996/06/04 21:44:39 1.2
+++ mod_fastcgi.c 1996/06/04 23:24:45
@@ -32,6 +32,9 @@
#include <errno.h>
#include <limits.h>
#include <sys/types.h>
+#ifdef __linux
+#include <sys/time.h>
+#endif
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@@ -3429,7 +3432,11 @@
*/
int GetStreamSize(FILE *fp)
{
+#ifdef _STDIO_USES_IOSTREAM
+ return ((fp->_IO_read_end) - (fp->_IO_read_ptr));
+#else
return fp->_cnt;
+#endif
}
int GetFromStream(FILE *fp, char **buf)