summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2021-09-08 02:00:43 +0200
committerMikael Magnusson <mikma@users.sourceforge.net>2021-09-08 02:01:26 +0200
commit40051598b96da61da796b7e0811512b18f3262ed (patch)
tree59cb117ad77fa25334289f3706fae49cd9a9a7f4
parent553ebab10f3ae777a55b10e2da0595c82cb06819 (diff)
WIP
-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()) {