From: Eric Wong <mwrap-perl@80x24.org>
To: mwrap-perl@80x24.org
Subject: [PATCH] set un.sun_len on *BSD systems
Date: Sat, 10 Dec 2022 21:11:41 +0000 [thread overview]
Message-ID: <20221210211141.89951-1-mwrap-perl@80x24.org> (raw)
Maybe this fixes some t/mwrap-httpd.t reliability problems I've
noticed on FreeBSD...
---
Makefile.PL | 4 +++-
mwrap_httpd.h | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/Makefile.PL b/Makefile.PL
index 3f1200b..6f563c1 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -104,6 +104,8 @@ push @writemakefile_args, (
WriteMakefile(@writemakefile_args);
+my $tflags = $ccflags;
+$tflags .= ' -DHAS_SOCKADDR_SA_LEN ' if $Config{d_sockaddr_sa_len};
sub MY::postamble {
<<EOF;
N = \$\$(( \$\$(nproc 2>/dev/null || gnproc 2>/dev/null || echo 2) + 1 ))
@@ -114,7 +116,7 @@ check-manifest :: MANIFEST
build.env :: Makefile
echo >\$\@+ extra_linker_flags=$LIBS -lpthread
- echo >>\$\@+ extra_compiler_flags=-I. $INC $Config{ccflags} $ccflags
+ echo >>\$\@+ extra_compiler_flags=-I. $INC $Config{ccflags} $tflags
mv \$\@+ \$\@
pure_all :: build.env
diff --git a/mwrap_httpd.h b/mwrap_httpd.h
index 13ac256..5c5a58b 100644
--- a/mwrap_httpd.h
+++ b/mwrap_httpd.h
@@ -942,7 +942,9 @@ static void h1d_event_step(struct mw_h1d *h1d)
static int h1d_init(struct mw_h1d *h1d, const char *menv)
{
union mw_sockaddr sa = { .un = { .sun_family = AF_UNIX } };
-
+#ifdef HAS_SOCKADDR_SA_LEN
+ sa.un.sun_len = (unsigned char)sizeof(struct sockaddr_un);
+#endif
const char *env = strstr(menv, "socket_dir:");
if (!env) return 1;
if (env != menv && env[-1] != ',')
reply other threads:[~2022-12-10 21:11 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221210211141.89951-1-mwrap-perl@80x24.org \
--to=mwrap-perl@80x24.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mwrap-perl.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).