httpd: NOMMU fixes by Alex Landau <landau_alex@yahoo.com>
authorDenis Vlasenko <vda.linux@googlemail.com>
Sat, 23 Jun 2007 23:14:02 +0000 (23:14 -0000)
committerDenis Vlasenko <vda.linux@googlemail.com>
Sat, 23 Jun 2007 23:14:02 +0000 (23:14 -0000)
networking/httpd.c

index 529f66b..8c0a83e 100644 (file)
@@ -841,6 +841,7 @@ static void decodeBase64(char *Data)
  * $Errors: None
  *
  ****************************************************************************/
+#if BB_MMU
 static int openServer(void)
 {
        int fd;
@@ -850,6 +851,7 @@ static int openServer(void)
        xlisten(fd, 9);
        return fd;
 }
+#endif
 
 /****************************************************************************
  *
@@ -1821,6 +1823,7 @@ static void handleIncoming(void)
        close(accepted_socket);
 }
 
+#if BB_MMU
 /****************************************************************************
  *
  > $Function: miniHttpd()
@@ -1900,6 +1903,7 @@ static int miniHttpd(int server)
        } /* while (1) */
        return 0;
 }
+#endif
 
 /* from inetd */
 static int miniHttpd_inetd(void)
@@ -2033,6 +2037,7 @@ int httpd_main(int argc, char **argv)
 
        xchdir(home_httpd);
        if (!(opt & OPT_INETD)) {
+#if BB_MMU
                signal(SIGCHLD, SIG_IGN);
                server_socket = openServer();
 #if ENABLE_FEATURE_HTTPD_SETUID
@@ -2046,6 +2051,9 @@ int httpd_main(int argc, char **argv)
                        xsetuid(ugid.uid);
                }
 #endif
+#else  /* BB_MMU */
+               bb_error_msg_and_die("-i is required");
+#endif
        }
 
 #if ENABLE_FEATURE_HTTPD_CGI
@@ -2069,7 +2077,11 @@ int httpd_main(int argc, char **argv)
        if (opt & OPT_INETD)
                return miniHttpd_inetd();
 
+#if BB_MMU
        if (!(opt & OPT_FOREGROUND))
                bb_daemonize(0);     /* don't change current directory */
        return miniHttpd(server_socket);
+#else
+       return 0;                               /* not reached */
+#endif
 }