projects
/
project
/
uhttpd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
minor cleanup
[project/uhttpd.git]
/
main.c
diff --git
a/main.c
b/main.c
index
1172640
..
3013dab
100644
(file)
--- a/
main.c
+++ b/
main.c
@@
-98,7
+98,7
@@
static void uh_config_parse(void)
fclose(c);
}
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;
{
char *host = NULL;
char *port = arg;
@@
-110,7
+110,8
@@
static void add_listener_arg(char *arg, bool tls)
port = s + 1;
*s = 0;
}
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 int usage(const char *name)
@@
-158,9
+159,12
@@
static int usage(const char *name)
static void init_defaults(void)
{
static void init_defaults(void)
{
+ conf.script_timeout = 60;
conf.network_timeout = 30;
conf.http_keepalive = 0; /* fixme */
conf.max_requests = 3;
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");
uh_index_add("index.html");
uh_index_add("index.htm");
@@
-174,6
+178,7
@@
int main(int argc, char **argv)
char *port;
int opt, ch;
int cur_fd;
char *port;
int opt, ch;
int cur_fd;
+ int bound = 0;
init_defaults();
signal(SIGPIPE, SIG_IGN);
init_defaults();
signal(SIGPIPE, SIG_IGN);
@@
-186,7
+191,7
@@
int main(int argc, char **argv)
tls = true;
/* fall through */
case 'p':
tls = true;
/* fall through */
case 'p':
- add_listener_arg(optarg, tls);
+
bound +=
add_listener_arg(optarg, tls);
break;
case 'h':
break;
case 'h':
@@
-289,6
+294,11
@@
int main(int argc, char **argv)
uh_config_parse();
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()) {
/* fork (if not disabled) */
if (!nofork) {
switch (fork()) {