busybox current status

Denis Vlasenko vda.linux at googlemail.com
Sun Jan 14 20:10:13 UTC 2007


On Sunday 14 January 2007 15:28, Mathias Jeschke wrote:
> * Denis Vlasenko <vda.linux at googlemail.com> wrote:
> 
> > To do:
> > 
> > * stabilize networking prior to 1.4.0
> 
> * Fix broken inetd mode in httpd!

Applied this to svn:

diff -urpN busybox.0/networking/httpd.c busybox.1/networking/httpd.c
--- busybox.0/networking/httpd.c        2007-01-14 15:45:14.000000000 +0100
+++ busybox.1/networking/httpd.c        2007-01-14 18:02:46.000000000 +0100
@@ -901,7 +901,9 @@ static int sendHeaders(HttpResponseNum r
        }
        if (DEBUG)
                fprintf(stderr, "headers: '%s'\n", buf);
-       return full_write(config->accepted_socket, buf, len);
+       i = config->accepted_socket;
+       if (i == 0) i++; /* write to fd# 1 in inetd mode */
+       return full_write(i, buf, len);
 }

 /****************************************************************************
@@ -1302,7 +1304,9 @@ static int sendFile(const char *url)
                sendHeaders(HTTP_OK);
                /* TODO: sendfile() */
                while ((count = full_read(f, buf, MAX_MEMORY_BUFF)) > 0) {
-                       if (full_write(config->accepted_socket, buf, count) != count)
+                       int fd = config->accepted_socket;
+                       if (fd == 0) fd++; /* write to fd# 1 in inetd mode */
+                       if (full_write(fd, buf, count) != count)
                                break;
                }
                close(f);

I think it solves the problem. If not, let me know.
--
vda



More information about the busybox mailing list