aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author"Vladimir N. Oleynik" <dzo@simtreas.ru>2005-12-20 11:02:54 +0000
committer"Vladimir N. Oleynik" <dzo@simtreas.ru>2005-12-20 11:02:54 +0000
commit6b903a2d8a76354078de536929e6a638c1f29330 (patch)
treef6fec754bac09d6ac5bc63589604b30e53490be8
parent9a1e25d994733a05cbcea2b573347a01e6a03695 (diff)
downloadbusybox-w32-6b903a2d8a76354078de536929e6a638c1f29330.tar.gz
busybox-w32-6b903a2d8a76354078de536929e6a638c1f29330.tar.bz2
busybox-w32-6b903a2d8a76354078de536929e6a638c1f29330.zip
remove debug feature for production
-rw-r--r--networking/httpd.c138
1 files changed, 71 insertions, 67 deletions
diff --git a/networking/httpd.c b/networking/httpd.c
index 11e89f64a..76c434628 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -168,6 +168,15 @@ static const char home[] = "./";
168#undef CONFIG_FEATURE_HTTPD_CGI 168#undef CONFIG_FEATURE_HTTPD_CGI
169#undef CONFIG_FEATURE_HTTPD_SETUID 169#undef CONFIG_FEATURE_HTTPD_SETUID
170#undef CONFIG_FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP 170#undef CONFIG_FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP
171#undef ENABLE_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY
172#undef ENABLE_FEATURE_HTTPD_BASIC_AUTH
173#undef ENABLE_FEATURE_HTTPD_AUTH_MD5
174#undef ENABLE_FEATURE_HTTPD_ENCODE_URL_STR
175#undef ENABLE_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV
176#undef ENABLE_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES
177#undef ENABLE_FEATURE_HTTPD_CGI
178#undef ENABLE_FEATURE_HTTPD_SETUID
179#undef ENABLE_FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP
171/* enable all features now */ 180/* enable all features now */
172#define CONFIG_FEATURE_HTTPD_BASIC_AUTH 181#define CONFIG_FEATURE_HTTPD_BASIC_AUTH
173#define CONFIG_FEATURE_HTTPD_AUTH_MD5 182#define CONFIG_FEATURE_HTTPD_AUTH_MD5
@@ -177,6 +186,15 @@ static const char home[] = "./";
177#define CONFIG_FEATURE_HTTPD_CGI 186#define CONFIG_FEATURE_HTTPD_CGI
178#define CONFIG_FEATURE_HTTPD_SETUID 187#define CONFIG_FEATURE_HTTPD_SETUID
179#define CONFIG_FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP 188#define CONFIG_FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP
189#define ENABLE_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY 0
190#define ENABLE_FEATURE_HTTPD_BASIC_AUTH 1
191#define ENABLE_FEATURE_HTTPD_AUTH_MD5 1
192#define ENABLE_FEATURE_HTTPD_ENCODE_URL_STR 1
193#define ENABLE_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV 1
194#define ENABLE_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES 1
195#define ENABLE_FEATURE_HTTPD_CGI 1
196#define ENABLE_FEATURE_HTTPD_SETUID 1
197#define ENABLE_FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP 1
180 198
181/* require from libbb.a for linking */ 199/* require from libbb.a for linking */
182const char *bb_applet_name = "httpd"; 200const char *bb_applet_name = "httpd";
@@ -196,6 +214,10 @@ void bb_show_usage(void)
196#undef DEBUG 214#undef DEBUG
197#endif 215#endif
198 216
217#ifndef DEBUG
218# define DEBUG 0
219#endif
220
199#define MAX_MEMORY_BUFF 8192 /* IO buffer */ 221#define MAX_MEMORY_BUFF 8192 /* IO buffer */
200 222
201typedef struct HT_ACCESS { 223typedef struct HT_ACCESS {
@@ -229,7 +251,7 @@ typedef struct
229 const char *configFile; 251 const char *configFile;
230 252
231 unsigned int rmt_ip; 253 unsigned int rmt_ip;
232#if defined(CONFIG_FEATURE_HTTPD_CGI) || defined(DEBUG) 254#if ENABLE_FEATURE_HTTPD_CGI || DEBUG
233 char rmt_ip_str[16]; /* for set env REMOTE_ADDR */ 255 char rmt_ip_str[16]; /* for set env REMOTE_ADDR */
234#endif 256#endif
235 unsigned port; /* server initial port and for 257 unsigned port; /* server initial port and for
@@ -253,12 +275,11 @@ typedef struct
253 275
254#ifndef CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY 276#ifndef CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY
255 int accepted_socket; 277 int accepted_socket;
256#define a_c_r config->accepted_socket 278# define a_c_r config->accepted_socket
257#define a_c_w config->accepted_socket 279# define a_c_w config->accepted_socket
258 int debugHttpd; /* if seted, don`t stay daemon */
259#else 280#else
260#define a_c_r 0 281# define a_c_r 0
261#define a_c_w 1 282# define a_c_w 1
262#endif 283#endif
263 volatile int alarm_signaled; 284 volatile int alarm_signaled;
264 285
@@ -1007,8 +1028,8 @@ static int sendHeaders(HttpResponseNum responseNum)
1007 responseNum, responseString, 1028 responseNum, responseString,
1008 responseNum, responseString, infoString); 1029 responseNum, responseString, infoString);
1009 } 1030 }
1010#ifdef DEBUG 1031#if DEBUG
1011 if (config->debugHttpd) fprintf(stderr, "Headers: '%s'", buf); 1032 fprintf(stderr, "Headers: '%s'", buf);
1012#endif 1033#endif
1013 return bb_full_write(a_c_w, buf, len); 1034 return bb_full_write(a_c_w, buf, len);
1014} 1035}
@@ -1106,10 +1127,7 @@ static int sendCgi(const char *url,
1106 1127
1107 dup2(inFd, 0); // replace stdin with the pipe 1128 dup2(inFd, 0); // replace stdin with the pipe
1108 dup2(outFd, 1); // replace stdout with the pipe 1129 dup2(outFd, 1); // replace stdout with the pipe
1109 1130 if(!DEBUG)
1110#ifndef CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY
1111 if (!config->debugHttpd)
1112#endif
1113 dup2(outFd, 2); // replace stderr with the pipe 1131 dup2(outFd, 2); // replace stderr with the pipe
1114 1132
1115 close(toCgi[0]); 1133 close(toCgi[0]);
@@ -1247,13 +1265,11 @@ static int sendCgi(const char *url,
1247 if (nfound <= 0) { 1265 if (nfound <= 0) {
1248 if (waitpid(pid, &status, WNOHANG) > 0) { 1266 if (waitpid(pid, &status, WNOHANG) > 0) {
1249 close(inFd); 1267 close(inFd);
1250#ifdef DEBUG 1268#if DEBUG
1251 if (config->debugHttpd) { 1269 if (WIFEXITED(status))
1252 if (WIFEXITED(status))
1253 bb_error_msg("piped has exited with status=%d", WEXITSTATUS(status)); 1270 bb_error_msg("piped has exited with status=%d", WEXITSTATUS(status));
1254 if (WIFSIGNALED(status)) 1271 if (WIFSIGNALED(status))
1255 bb_error_msg("piped has exited with signal=%d", WTERMSIG(status)); 1272 bb_error_msg("piped has exited with signal=%d", WTERMSIG(status));
1256 }
1257#endif 1273#endif
1258 break; 1274 break;
1259 } 1275 }
@@ -1309,9 +1325,8 @@ static int sendCgi(const char *url,
1309 if (bb_full_write(s, rbuf, count) != count) 1325 if (bb_full_write(s, rbuf, count) != count)
1310 break; 1326 break;
1311 1327
1312#ifdef DEBUG 1328#if DEBUG
1313 if (config->debugHttpd) 1329 fprintf(stderr, "cgi read %d bytes\n", count);
1314 fprintf(stderr, "cgi read %d bytes\n", count);
1315#endif 1330#endif
1316 } 1331 }
1317 } 1332 }
@@ -1363,10 +1378,9 @@ static int sendFile(const char *url)
1363 } 1378 }
1364#endif /* CONFIG_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES */ 1379#endif /* CONFIG_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES */
1365 1380
1366#ifdef DEBUG 1381#if DEBUG
1367 if (config->debugHttpd) 1382 fprintf(stderr, "Sending file '%s' Content-type: %s\n",
1368 fprintf(stderr, "Sending file '%s' Content-type: %s\n", 1383 url, config->httpd_found.found_mime_type);
1369 url, config->httpd_found.found_mime_type);
1370#endif 1384#endif
1371 1385
1372 f = open(url, O_RDONLY); 1386 f = open(url, O_RDONLY);
@@ -1381,9 +1395,8 @@ static int sendFile(const char *url)
1381 } 1395 }
1382 close(f); 1396 close(f);
1383 } else { 1397 } else {
1384#ifdef DEBUG 1398#if DEBUG
1385 if (config->debugHttpd) 1399 bb_perror_msg("Unable to open '%s'", url);
1386 bb_perror_msg("Unable to open '%s'", url);
1387#endif 1400#endif
1388 sendHeaders(HTTP_NOT_FOUND); 1401 sendHeaders(HTTP_NOT_FOUND);
1389 } 1402 }
@@ -1397,10 +1410,9 @@ static int checkPermIP(void)
1397 1410
1398 /* This could stand some work */ 1411 /* This could stand some work */
1399 for (cur = config->ip_a_d; cur; cur = cur->next) { 1412 for (cur = config->ip_a_d; cur; cur = cur->next) {
1400#ifdef DEBUG 1413#if DEBUG
1401 if (config->debugHttpd) { 1414 fprintf(stderr, "checkPermIP: '%s' ? ", config->rmt_ip_str);
1402 fprintf(stderr, "checkPermIP: '%s' ? ", config->rmt_ip_str); 1415 fprintf(stderr, "'%u.%u.%u.%u/%u.%u.%u.%u'\n",
1403 fprintf(stderr, "'%u.%u.%u.%u/%u.%u.%u.%u'\n",
1404 (unsigned char)(cur->ip >> 24), 1416 (unsigned char)(cur->ip >> 24),
1405 (unsigned char)(cur->ip >> 16), 1417 (unsigned char)(cur->ip >> 16),
1406 (unsigned char)(cur->ip >> 8), 1418 (unsigned char)(cur->ip >> 8),
@@ -1409,7 +1421,6 @@ static int checkPermIP(void)
1409 (unsigned char)(cur->mask >> 16), 1421 (unsigned char)(cur->mask >> 16),
1410 (unsigned char)(cur->mask >> 8), 1422 (unsigned char)(cur->mask >> 8),
1411 cur->mask & 0xff); 1423 cur->mask & 0xff);
1412 }
1413#endif 1424#endif
1414 if((config->rmt_ip & cur->mask) == cur->ip) 1425 if((config->rmt_ip & cur->mask) == cur->ip)
1415 return cur->allow_deny == 'A'; /* Allow/Deny */ 1426 return cur->allow_deny == 'A'; /* Allow/Deny */
@@ -1451,9 +1462,8 @@ static int checkPerm(const char *path, const char *request)
1451 if(prev != NULL && strcmp(prev, p0) != 0) 1462 if(prev != NULL && strcmp(prev, p0) != 0)
1452 continue; /* find next identical */ 1463 continue; /* find next identical */
1453 p = cur->after_colon; 1464 p = cur->after_colon;
1454#ifdef DEBUG 1465#if DEBUG
1455 if (config->debugHttpd) 1466 fprintf(stderr,"checkPerm: '%s' ? '%s'\n", p0, request);
1456 fprintf(stderr,"checkPerm: '%s' ? '%s'\n", p0, request);
1457#endif 1467#endif
1458 { 1468 {
1459 size_t l = strlen(p0); 1469 size_t l = strlen(p0);
@@ -1641,15 +1651,13 @@ BAD_REQUEST:
1641 test = purl; /* end ptr */ 1651 test = purl; /* end ptr */
1642 1652
1643 /* If URL is directory, adding '/' */ 1653 /* If URL is directory, adding '/' */
1644 /* If URL is directory, adding '/' */
1645 if(test[-1] != '/') { 1654 if(test[-1] != '/') {
1646 if ( is_directory(url + 1, 1, &sb) ) { 1655 if ( is_directory(url + 1, 1, &sb) ) {
1647 config->httpd_found.found_moved_temporarily = url; 1656 config->httpd_found.found_moved_temporarily = url;
1648 } 1657 }
1649 } 1658 }
1650#ifdef DEBUG 1659#if DEBUG
1651 if (config->debugHttpd) 1660 fprintf(stderr, "url='%s', args=%s\n", url, config->query);
1652 fprintf(stderr, "url='%s', args=%s\n", url, config->query);
1653#endif 1661#endif
1654 1662
1655 test = url; 1663 test = url;
@@ -1672,8 +1680,8 @@ BAD_REQUEST:
1672 if(count <= 0) 1680 if(count <= 0)
1673 break; 1681 break;
1674 1682
1675#ifdef DEBUG 1683#if DEBUG
1676 if (config->debugHttpd) fprintf(stderr, "Header: '%s'\n", buf); 1684 fprintf(stderr, "Header: '%s'\n", buf);
1677#endif 1685#endif
1678 1686
1679#ifdef CONFIG_FEATURE_HTTPD_CGI 1687#ifdef CONFIG_FEATURE_HTTPD_CGI
@@ -1737,10 +1745,9 @@ FORBIDDEN: /* protect listing /cgi-bin */
1737 1745
1738 if(config->httpd_found.found_moved_temporarily) { 1746 if(config->httpd_found.found_moved_temporarily) {
1739 sendHeaders(HTTP_MOVED_TEMPORARILY); 1747 sendHeaders(HTTP_MOVED_TEMPORARILY);
1740#ifdef DEBUG 1748#if DEBUG
1741 /* clear unforked memory flag */ 1749 /* clear unforked memory flag */
1742 if(config->debugHttpd) 1750 config->httpd_found.found_moved_temporarily = NULL;
1743 config->httpd_found.found_moved_temporarily = NULL;
1744#endif 1751#endif
1745 break; 1752 break;
1746 } 1753 }
@@ -1783,8 +1790,8 @@ FORBIDDEN: /* protect listing /cgi-bin */
1783 1790
1784#ifndef CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY 1791#ifndef CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY
1785/* from inetd don`t looping: freeing, closing automatic from exit always */ 1792/* from inetd don`t looping: freeing, closing automatic from exit always */
1786# ifdef DEBUG 1793# if DEBUG
1787 if (config->debugHttpd) fprintf(stderr, "closing socket\n"); 1794 fprintf(stderr, "closing socket\n");
1788# endif 1795# endif
1789# ifdef CONFIG_FEATURE_HTTPD_CGI 1796# ifdef CONFIG_FEATURE_HTTPD_CGI
1790 free(cookie); 1797 free(cookie);
@@ -1853,18 +1860,16 @@ static int miniHttpd(int server)
1853 } 1860 }
1854 config->accepted_socket = s; 1861 config->accepted_socket = s;
1855 config->rmt_ip = ntohl(fromAddr.sin_addr.s_addr); 1862 config->rmt_ip = ntohl(fromAddr.sin_addr.s_addr);
1856#if defined(CONFIG_FEATURE_HTTPD_CGI) || defined(DEBUG) 1863#if ENABLE_FEATURE_HTTPD_CGI || DEBUG
1857 sprintf(config->rmt_ip_str, "%u.%u.%u.%u", 1864 sprintf(config->rmt_ip_str, "%u.%u.%u.%u",
1858 (unsigned char)(config->rmt_ip >> 24), 1865 (unsigned char)(config->rmt_ip >> 24),
1859 (unsigned char)(config->rmt_ip >> 16), 1866 (unsigned char)(config->rmt_ip >> 16),
1860 (unsigned char)(config->rmt_ip >> 8), 1867 (unsigned char)(config->rmt_ip >> 8),
1861 config->rmt_ip & 0xff); 1868 config->rmt_ip & 0xff);
1862 config->port = ntohs(fromAddr.sin_port); 1869 config->port = ntohs(fromAddr.sin_port);
1863#ifdef DEBUG 1870#if DEBUG
1864 if (config->debugHttpd) { 1871 bb_error_msg("connection from IP=%s, port %u\n",
1865 bb_error_msg("connection from IP=%s, port %u\n",
1866 config->rmt_ip_str, config->port); 1872 config->rmt_ip_str, config->port);
1867 }
1868#endif 1873#endif
1869#endif /* CONFIG_FEATURE_HTTPD_CGI */ 1874#endif /* CONFIG_FEATURE_HTTPD_CGI */
1870 1875
@@ -1872,15 +1877,19 @@ static int miniHttpd(int server)
1872 on = 1; 1877 on = 1;
1873 setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, (void *)&on, sizeof (on)); 1878 setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, (void *)&on, sizeof (on));
1874 1879
1875 if (config->debugHttpd || fork() == 0) { 1880#if !DEBUG
1881 if (fork() == 0)
1882#endif
1883 {
1876 /* This is the spawned thread */ 1884 /* This is the spawned thread */
1877#ifdef CONFIG_FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP 1885#ifdef CONFIG_FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP
1878 /* protect reload config, may be confuse checking */ 1886 /* protect reload config, may be confuse checking */
1879 signal(SIGHUP, SIG_IGN); 1887 signal(SIGHUP, SIG_IGN);
1880#endif 1888#endif
1881 handleIncoming(); 1889 handleIncoming();
1882 if(!config->debugHttpd) 1890#if !DEBUG
1883 exit(0); 1891 exit(0);
1892#endif
1884 } 1893 }
1885 close(s); 1894 close(s);
1886 } 1895 }
@@ -1899,7 +1908,7 @@ static int miniHttpd(void)
1899 1908
1900 getpeername (0, (struct sockaddr *)&fromAddrLen, &sinlen); 1909 getpeername (0, (struct sockaddr *)&fromAddrLen, &sinlen);
1901 config->rmt_ip = ntohl(fromAddrLen.sin_addr.s_addr); 1910 config->rmt_ip = ntohl(fromAddrLen.sin_addr.s_addr);
1902#if defined(CONFIG_FEATURE_HTTPD_CGI) || defined(DEBUG) 1911#if ENABLE_FEATURE_HTTPD_CGI
1903 sprintf(config->rmt_ip_str, "%u.%u.%u.%u", 1912 sprintf(config->rmt_ip_str, "%u.%u.%u.%u",
1904 (unsigned char)(config->rmt_ip >> 24), 1913 (unsigned char)(config->rmt_ip >> 24),
1905 (unsigned char)(config->rmt_ip >> 16), 1914 (unsigned char)(config->rmt_ip >> 16),
@@ -1945,7 +1954,7 @@ static const char httpd_opts[]="c:d:h:"
1945#define OPT_INC_3 ENABLE_FEATURE_HTTPD_AUTH_MD5 1954#define OPT_INC_3 ENABLE_FEATURE_HTTPD_AUTH_MD5
1946 1955
1947#ifndef CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY 1956#ifndef CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY
1948 "p:v" 1957 "p:"
1949#endif 1958#endif
1950#ifdef CONFIG_FEATURE_HTTPD_SETUID 1959#ifdef CONFIG_FEATURE_HTTPD_SETUID
1951 "u:" 1960 "u:"
@@ -1959,8 +1968,7 @@ static const char httpd_opts[]="c:d:h:"
1959#define OPT_REALM (1<<(2+OPT_INC_1+OPT_INC_2)) /* r */ 1968#define OPT_REALM (1<<(2+OPT_INC_1+OPT_INC_2)) /* r */
1960#define OPT_MD5 (1<<(2+OPT_INC_1+OPT_INC_2+OPT_INC_3)) /* m */ 1969#define OPT_MD5 (1<<(2+OPT_INC_1+OPT_INC_2+OPT_INC_3)) /* m */
1961#define OPT_PORT (1<<(3+OPT_INC_1+OPT_INC_2+OPT_INC_3)) /* p */ 1970#define OPT_PORT (1<<(3+OPT_INC_1+OPT_INC_2+OPT_INC_3)) /* p */
1962#define OPT_DEBUG (1<<(4+OPT_INC_1+OPT_INC_2+OPT_INC_3)) /* v */ 1971#define OPT_SETUID (1<<(4+OPT_INC_1+OPT_INC_2+OPT_INC_3)) /* u */
1963#define OPT_SETUID (1<<(5+OPT_INC_1+OPT_INC_2+OPT_INC_3)) /* u */
1964 1972
1965 1973
1966#ifdef HTTPD_STANDALONE 1974#ifdef HTTPD_STANDALONE
@@ -1977,9 +1985,6 @@ int httpd_main(int argc, char *argv[])
1977#endif 1985#endif
1978#ifndef CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY 1986#ifndef CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY
1979 const char *s_port; 1987 const char *s_port;
1980#endif
1981
1982#ifndef CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY
1983 int server; 1988 int server;
1984#endif 1989#endif
1985 1990
@@ -2016,10 +2021,10 @@ int httpd_main(int argc, char *argv[])
2016#endif 2021#endif
2017#ifndef CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY 2022#ifndef CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY
2018 , &s_port 2023 , &s_port
2024#endif
2019#ifdef CONFIG_FEATURE_HTTPD_SETUID 2025#ifdef CONFIG_FEATURE_HTTPD_SETUID
2020 , &s_uid 2026 , &s_uid
2021#endif 2027#endif
2022#endif
2023 ); 2028 );
2024 2029
2025 if(opt & OPT_DECODE_URL) { 2030 if(opt & OPT_DECODE_URL) {
@@ -2041,7 +2046,6 @@ int httpd_main(int argc, char *argv[])
2041#ifndef CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY 2046#ifndef CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY
2042 if(opt & OPT_PORT) 2047 if(opt & OPT_PORT)
2043 config->port = bb_xgetlarg(s_port, 10, 1, 0xffff); 2048 config->port = bb_xgetlarg(s_port, 10, 1, 0xffff);
2044 config->debugHttpd = opt & OPT_DEBUG;
2045#ifdef CONFIG_FEATURE_HTTPD_SETUID 2049#ifdef CONFIG_FEATURE_HTTPD_SETUID
2046 if(opt & OPT_SETUID) { 2050 if(opt & OPT_SETUID) {
2047 char *e; 2051 char *e;
@@ -2088,11 +2092,11 @@ int httpd_main(int argc, char *argv[])
2088 parse_conf(default_path_httpd_conf, FIRST_PARSE); 2092 parse_conf(default_path_httpd_conf, FIRST_PARSE);
2089#endif 2093#endif
2090 2094
2091#ifndef CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY 2095#if !ENABLE_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY
2092 if (!config->debugHttpd) { 2096# if !DEBUG
2093 if (daemon(1, 0) < 0) /* don`t change curent directory */ 2097 if (daemon(1, 0) < 0) /* don`t change curent directory */
2094 bb_perror_msg_and_die("daemon"); 2098 bb_perror_msg_and_die("daemon");
2095 } 2099# endif
2096 return miniHttpd(server); 2100 return miniHttpd(server);
2097#else 2101#else
2098 return miniHttpd(); 2102 return miniHttpd();