summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/main.c b/main.c
index 8f51813..1d20f28 100644
--- a/main.c
+++ b/main.c
@@ -134,7 +134,7 @@ static int usage(const char *name)
"Usage: %s -p [addr:]port -h docroot\n"
" -f Do not fork to background\n"
" -c file Configuration file, default is '/etc/httpd.conf'\n"
- " -b interface Bind subsequent ports (and addresses) to specified"
+ " -b interface Bind subsequent ports (and addresses) to specified\n"
" network interface with SO_BINDTODEVICE\n"
" -p [addr:]port Bind to specified address and port, multiple allowed\n"
#ifdef HAVE_TLS
@@ -288,8 +288,10 @@ int main(int argc, char **argv)
case 'b':
if (optarg[0] == '\0')
device = NULL;
- else
- device = optarg;
+ else {
+ free(device);
+ device = strdup(optarg);
+ }
break;
case 's':
@@ -564,6 +566,9 @@ int main(int argc, char **argv)
return 1;
#endif
+ free(device);
+ device = NULL;
+
/* fork (if not disabled) */
if (!nofork) {
switch (fork()) {