lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LYNX-DEV LYCgi.c patch for CGI programs which wait for close of input


From: Mark H. Wilkinson
Subject: LYNX-DEV LYCgi.c patch for CGI programs which wait for close of input
Date: Wed, 29 Oct 1997 12:21:05 GMT

I've noticed that some CGI programs wait for their standard input to
be closed when processing posted forms. The LYCgi.c code doesn't do
this: it reads the results before closing its end of the pipe. The
simple fix is included below.

-Mark.

--- LYCgi.c.old Wed Oct 29 12:20:18 1997
+++ LYCgi.c     Wed Oct 29 12:20:37 1997
@@ -359,10 +359,11 @@
                                "LYNXCGI: 
Writing:\n%s----------------------------------\n",
                                anAnchor->post_data);                   
                    }
                    write(fd1[1], anAnchor->post_data,
                          strlen(anAnchor->post_data));
+                   close(fd1[1]);
                }
                
                total_chars = 0;
                while((chars = read(fd2[0], buf, sizeof(buf))) > 0) {
                    char line[40];
@@ -380,13 +381,10 @@
                while (wait(&wstatus) != pid)
                    ; /* do nothing */
 #else
                waitpid(pid, &wstatus, 0); /* wait for child */
 #endif
-               if (anAnchor->post_data) {
-                   close(fd1[1]);
-               }
                close(fd2[0]);
                status = HT_LOADED;
                
            } else if (pid == 0) { /* The Bad, */
                char **argv = NULL;
;
; To UNSUBSCRIBE:  Send a mail message to address@hidden
;                  with "unsubscribe lynx-dev" (without the
;                  quotation marks) on a line by itself.
;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]