pkgsrc/www/cgic/patches/patch-ac
adam 8e5abd345e Changes 2.05:
Temporary files used to accept file uploads were not closed properly. This
resulted in a file descriptor leak, which was unlikely to be serious because of
the short lifespan of CGI programs and the fact that very few forms upload many
files at once. However, on the Windows platform and possibly some others, file
locking semantics prevented file uploads from working at all with these files
not properly closed. Fixed in 2.05.

Changes 2.04:
Documentation fixes: the cgiHtmlEscape, cgiHtmlEscapeData, cgiValueEscape, and
cgiValueEscapeData routines were named incorrectly in the manual. No code
changes in version 2.04.

Changes 2.03:
Support for setting cookies has been reimplemented. The new code closely
follows the actual practice of web sites that successfully use cookies, rather
than attempting to implement the specification. The new code can successfully
set more than one cookie at a time in typical web browsers.
2006-01-06 22:46:51 +00:00

46 lines
1,021 B
Text

$NetBSD: patch-ac,v 1.2 2006/01/06 22:46:51 adam Exp $
--- cgic.c.orig 2004-11-15 17:57:59.000000000 +0100
+++ cgic.c
@@ -119,8 +119,9 @@ static void cgiFreeResources();
static int cgiStrEqNc(char *s1, char *s2);
static int cgiStrBeginsNc(char *s1, char *s2);
-int main(int argc, char *argv[]) {
- int result;
+int
+cgiInit(void)
+{
char *cgiContentLengthString;
char *e;
cgiSetupConstants();
@@ -206,17 +207,6 @@ int main(int argc, char *argv[]) {
cgiOut = stdout;
cgiRestored = 0;
-
- /* These five lines keep compilers from
- producing warnings that argc and argv
- are unused. They have no actual function. */
- if (argc) {
- if (argv[0]) {
- cgiRestored = 0;
- }
- }
-
-
if (cgiStrEqNc(cgiRequestMethod, "post")) {
#ifdef CGICDEBUG
CGICDEBUGSTART
@@ -284,9 +274,8 @@ int main(int argc, char *argv[]) {
#endif /* CGICDEBUG */
}
}
- result = cgiMain();
- cgiFreeResources();
- return result;
+ atexit(cgiFreeResources);
+ return 0;
}
static void cgiGetenv(char **s, char *var){