From 1d936c968a213319eff46e78284c9dd45d6c79dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Mon, 2 Jan 2023 16:11:58 +0100 Subject: [PATCH] Warn if failed to read existing /etc/nsswitch.conf Commit 90424e7c ("Don't warn when failed to open /etc/nsswitch.conf") removed the logging for failing to read /etc/nsswitch.conf to reduce the noise in the case the file does not exists (e.g. musl based systems). Reintroduce a warning if /etc/nsswitch.conf exists but we failed to read it (e.g. permission denied). Improves: 90424e7c ("Don't warn when failed to open /etc/nsswitch.conf") --- lib/nss.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/nss.c b/lib/nss.c index 23d05182..89de2ac9 100644 --- a/lib/nss.c +++ b/lib/nss.c @@ -59,6 +59,9 @@ void nss_init(const char *nsswitch_path) { // subid: files nssfp = fopen(nsswitch_path, "r"); if (!nssfp) { + if (errno != ENOENT) + fprintf(shadow_logfd, "Failed opening %s: %m\n", nsswitch_path); + atomic_store(&nss_init_completed, true); return; }