diff -up shadow-4.9/lib/nss.c.shadow-logfd shadow-4.9/lib/nss.c --- shadow-4.9/lib/nss.c.shadow-logfd 2021-07-22 23:55:35.000000000 +0200 +++ shadow-4.9/lib/nss.c 2025-04-07 15:26:58.957447229 +0200 @@ -42,6 +42,10 @@ void nss_init(char *nsswitch_path) { char *line = NULL, *p, *token, *saveptr; size_t len = 0; + if (shadow_logfd == NULL) { + shadow_logfd = stderr; + } + if (atomic_flag_test_and_set(&nss_init_started)) { // Another thread has started nss_init, wait for it to complete while (!atomic_load(&nss_init_completed))