fclose(c);
}
-static void add_listener_arg(char *arg, bool tls)
+static int add_listener_arg(char *arg, bool tls)
{
char *host = NULL;
char *port = arg;
port = s + 1;
*s = 0;
}
- uh_socket_bind(host, port, tls);
+
+ return uh_socket_bind(host, port, tls);
}
static int usage(const char *name)
static void init_defaults(void)
{
+ conf.script_timeout = 60;
conf.network_timeout = 30;
conf.http_keepalive = 0; /* fixme */
conf.max_requests = 3;
+ conf.realm = "Protected Area";
+ conf.cgi_prefix = "/cgi-bin";
uh_index_add("index.html");
uh_index_add("index.htm");
char *port;
int opt, ch;
int cur_fd;
+ int bound = 0;
init_defaults();
signal(SIGPIPE, SIG_IGN);
tls = true;
/* fall through */
case 'p':
- add_listener_arg(optarg, tls);
+ bound += add_listener_arg(optarg, tls);
break;
case 'h':
uh_config_parse();
+ if (!bound) {
+ fprintf(stderr, "Error: No sockets bound, unable to continue\n");
+ return 1;
+ }
+
/* fork (if not disabled) */
if (!nofork) {
switch (fork()) {