svn commit: trunk/busybox/networking
vda at busybox.net
vda at busybox.net
Sun Jan 14 17:06:13 UTC 2007
Author: vda
Date: 2007-01-14 09:06:11 -0800 (Sun, 14 Jan 2007)
New Revision: 17304
Log:
httpd: use fd#1 in inetd mode
inetd: micro style fix
Modified:
trunk/busybox/networking/httpd.c
trunk/busybox/networking/inetd.c
Changeset:
Modified: trunk/busybox/networking/httpd.c
===================================================================
--- trunk/busybox/networking/httpd.c 2007-01-14 14:46:18 UTC (rev 17303)
+++ trunk/busybox/networking/httpd.c 2007-01-14 17:06:11 UTC (rev 17304)
@@ -846,7 +846,7 @@
const char *responseString = "";
const char *infoString = 0;
const char *mime_type;
- unsigned int i;
+ unsigned i;
time_t timer = time(0);
char timeStr[80];
int len;
@@ -901,7 +901,9 @@
}
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 @@
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);
@@ -1321,8 +1325,10 @@
/* This could stand some work */
for (cur = config->ip_a_d; cur; cur = cur->next) {
+#if ENABLE_FEATURE_HTTPD_CGI && DEBUG
+ fprintf(stderr, "checkPermIP: '%s' ? ", config->rmt_ip_str);
+#endif
#if DEBUG
- fprintf(stderr, "checkPermIP: '%s' ? ", config->rmt_ip_str);
fprintf(stderr, "'%u.%u.%u.%u/%u.%u.%u.%u'\n",
(unsigned char)(cur->ip >> 24),
(unsigned char)(cur->ip >> 16),
Modified: trunk/busybox/networking/inetd.c
===================================================================
--- trunk/busybox/networking/inetd.c 2007-01-14 14:46:18 UTC (rev 17303)
+++ trunk/busybox/networking/inetd.c 2007-01-14 17:06:11 UTC (rev 17304)
@@ -1470,7 +1470,7 @@
(*sep->se_bi->bi_fn)(ctrl, sep);
} else
#endif
- {
+ {
pwd = getpwnam(sep->se_user);
if (pwd == NULL) {
bb_error_msg("getpwnam: %s: no such user", sep->se_user);
More information about the busybox-cvs
mailing list