From: Joakim Sindholt <opensource@zhasha.com>
To: musl@lists.openwall.com
Subject: [musl] graceful nscd fallback on kernels without AF_UNIX support
Date: Sat, 3 Apr 2021 12:58:42 +0200 [thread overview]
Message-ID: <YGhKYlFaytwtuIjc@wirbelwind.zhasha.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 381 bytes --]
I was reminded of this coincidentally on IRC and apparently it was never
applied, presumably because I never actually sent a proper patch.
5 years ago someone came in asking about musl on a system without
AF_UNIX support and this patch is what we came up with. It does require
access to /dev/null which might itself be a problem now that musl is
shedding filesystem requirements.
[-- Attachment #2: 0001-nscd-fall-back-gracefully-on-kernels-without-AF_UNIX.patch --]
[-- Type: text/x-diff, Size: 851 bytes --]
From 9984ac4ad320844a91bbcdbc9f5fa07d3154621e Mon Sep 17 00:00:00 2001
From: Joakim Sindholt <opensource@zhasha.com>
Date: Sat, 3 Apr 2021 12:50:18 +0200
Subject: [PATCH] nscd: fall back gracefully on kernels without AF_UNIX support
---
src/passwd/nscd_query.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/passwd/nscd_query.c b/src/passwd/nscd_query.c
index d38e371b..8641e4f0 100644
--- a/src/passwd/nscd_query.c
+++ b/src/passwd/nscd_query.c
@@ -40,7 +40,13 @@ retry:
buf[0] = NSCDVERSION;
fd = socket(PF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0);
- if (fd < 0) return NULL;
+ if (fd < 0) {
+ if (errno == EACCES || errno == EAFNOSUPPORT || errno == EPROTONOSUPPORT) {
+ errno = errno_save;
+ return fopen("/dev/null", "re");
+ }
+ return 0;
+ }
if(!(f = fdopen(fd, "r"))) {
close(fd);
--
2.26.2
next reply other threads:[~2021-04-03 10:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-03 10:58 Joakim Sindholt [this message]
2021-04-03 14:42 ` Rich Felker
2021-04-03 15:03 ` Joakim Sindholt
2021-04-03 15:47 ` Rich Felker
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=YGhKYlFaytwtuIjc@wirbelwind.zhasha.com \
--to=opensource@zhasha.com \
--cc=musl@lists.openwall.com \
/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://git.vuxu.org/mirror/musl/
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 NNTP newsgroup(s).