Greg Hewgill informs me that the problem another user had reported
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Thu, 24 Sep 2009 10:05:09 +0000 (10:05 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Thu, 24 Sep 2009 10:05:09 +0000 (10:05 +0000)
with unexpected EADDRNOTAVAIL on MacOS can be worked around by
zeroing out the entire sockaddr_in structure before starting to put
things in it.

git-svn-id: svn://svn.tartarus.org/sgt/agedu@8660 cda61777-01e9-0310-a592-d414129be87e

httpd.c

diff --git a/httpd.c b/httpd.c
index 62c1ceb..e5ee270 100644 (file)
--- a/httpd.c
+++ b/httpd.c
@@ -430,6 +430,7 @@ void run_httpd(const void *t, int authmask, const struct httpd_config *dcfg,
        fprintf(stderr, "socket(PF_INET): %s\n", strerror(errno));
        exit(1);
     }
+    memset(&addr, 0, sizeof(addr));
     addr.sin_family = AF_INET;
     if (!dcfg->address) {
 #ifdef RANDOM_LOCALHOST