aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2007-01-14 17:06:11 +0000
committervda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2007-01-14 17:06:11 +0000
commit9fc5e3299d7f86e02cb565db54ec9bd304e127b8 (patch)
tree92a7b88794f22cb10aed7d59e6598da7688ccabc
parent841c7f39d82e1c1f636c7587483449e7743ca122 (diff)
downloadbusybox-w32-9fc5e3299d7f86e02cb565db54ec9bd304e127b8.tar.gz
busybox-w32-9fc5e3299d7f86e02cb565db54ec9bd304e127b8.tar.bz2
busybox-w32-9fc5e3299d7f86e02cb565db54ec9bd304e127b8.zip
httpd: use fd#1 in inetd mode
inetd: micro style fix git-svn-id: svn://busybox.net/trunk/busybox@17304 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r--networking/httpd.c14
-rw-r--r--networking/inetd.c2
2 files changed, 11 insertions, 5 deletions
diff --git a/networking/httpd.c b/networking/httpd.c
index f8773685e..d14b113a3 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -846,7 +846,7 @@ static int sendHeaders(HttpResponseNum responseNum)
846 const char *responseString = ""; 846 const char *responseString = "";
847 const char *infoString = 0; 847 const char *infoString = 0;
848 const char *mime_type; 848 const char *mime_type;
849 unsigned int i; 849 unsigned i;
850 time_t timer = time(0); 850 time_t timer = time(0);
851 char timeStr[80]; 851 char timeStr[80];
852 int len; 852 int len;
@@ -901,7 +901,9 @@ static int sendHeaders(HttpResponseNum responseNum)
901 } 901 }
902 if (DEBUG) 902 if (DEBUG)
903 fprintf(stderr, "headers: '%s'\n", buf); 903 fprintf(stderr, "headers: '%s'\n", buf);
904 return full_write(config->accepted_socket, buf, len); 904 i = config->accepted_socket;
905 if (i == 0) i++; /* write to fd# 1 in inetd mode */
906 return full_write(i, buf, len);
905} 907}
906 908
907/**************************************************************************** 909/****************************************************************************
@@ -1302,7 +1304,9 @@ static int sendFile(const char *url)
1302 sendHeaders(HTTP_OK); 1304 sendHeaders(HTTP_OK);
1303 /* TODO: sendfile() */ 1305 /* TODO: sendfile() */
1304 while ((count = full_read(f, buf, MAX_MEMORY_BUFF)) > 0) { 1306 while ((count = full_read(f, buf, MAX_MEMORY_BUFF)) > 0) {
1305 if (full_write(config->accepted_socket, buf, count) != count) 1307 int fd = config->accepted_socket;
1308 if (fd == 0) fd++; /* write to fd# 1 in inetd mode */
1309 if (full_write(fd, buf, count) != count)
1306 break; 1310 break;
1307 } 1311 }
1308 close(f); 1312 close(f);
@@ -1321,8 +1325,10 @@ static int checkPermIP(void)
1321 1325
1322 /* This could stand some work */ 1326 /* This could stand some work */
1323 for (cur = config->ip_a_d; cur; cur = cur->next) { 1327 for (cur = config->ip_a_d; cur; cur = cur->next) {
1324#if DEBUG 1328#if ENABLE_FEATURE_HTTPD_CGI && DEBUG
1325 fprintf(stderr, "checkPermIP: '%s' ? ", config->rmt_ip_str); 1329 fprintf(stderr, "checkPermIP: '%s' ? ", config->rmt_ip_str);
1330#endif
1331#if DEBUG
1326 fprintf(stderr, "'%u.%u.%u.%u/%u.%u.%u.%u'\n", 1332 fprintf(stderr, "'%u.%u.%u.%u/%u.%u.%u.%u'\n",
1327 (unsigned char)(cur->ip >> 24), 1333 (unsigned char)(cur->ip >> 24),
1328 (unsigned char)(cur->ip >> 16), 1334 (unsigned char)(cur->ip >> 16),
diff --git a/networking/inetd.c b/networking/inetd.c
index 3cf7b2d3b..370dcbbe0 100644
--- a/networking/inetd.c
+++ b/networking/inetd.c
@@ -1470,7 +1470,7 @@ inetd_main(int argc, char *argv[])
1470 (*sep->se_bi->bi_fn)(ctrl, sep); 1470 (*sep->se_bi->bi_fn)(ctrl, sep);
1471 } else 1471 } else
1472#endif 1472#endif
1473 { 1473 {
1474 pwd = getpwnam(sep->se_user); 1474 pwd = getpwnam(sep->se_user);
1475 if (pwd == NULL) { 1475 if (pwd == NULL) {
1476 bb_error_msg("getpwnam: %s: no such user", sep->se_user); 1476 bb_error_msg("getpwnam: %s: no such user", sep->se_user);