diff options
author | Joakim Sindholt <opensource@zhasha.com> | 2021-04-03 12:50:18 +0200 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2021-04-16 10:17:42 -0400 |
commit | 0ea78a6421322cab24d448670006ee2f99af3ac9 (patch) | |
tree | 650deaea887d974d5135e177e52a4242a5e7aa5e /src | |
parent | 95a540e176b3ebd57d6033fd23cf9fec8a5ddbe8 (diff) | |
download | musl-0ea78a6421322cab24d448670006ee2f99af3ac9.tar.gz musl-0ea78a6421322cab24d448670006ee2f99af3ac9.tar.xz musl-0ea78a6421322cab24d448670006ee2f99af3ac9.zip |
nscd: fall back gracefully on kernels without AF_UNIX support
Diffstat (limited to 'src')
-rw-r--r-- | src/passwd/nscd_query.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/passwd/nscd_query.c b/src/passwd/nscd_query.c index d38e371b..dc3406b8 100644 --- a/src/passwd/nscd_query.c +++ b/src/passwd/nscd_query.c @@ -40,7 +40,15 @@ retry: buf[0] = NSCDVERSION; fd = socket(PF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0); - if (fd < 0) return NULL; + if (fd < 0) { + if (errno == EAFNOSUPPORT) { + f = fopen("/dev/null", "re"); + if (f) + errno = errno_save; + return f; + } + return 0; + } if(!(f = fdopen(fd, "r"))) { close(fd); |