[PATCH] autofs-5.1.9 - don't call unsetenv in sd_notify
Jun Eeo <[email protected]> Mon, 15 Sep 2025 13:26:05 +0100
| Newsgroups | org.kernel.vger.autofs |
|---|---|
| Message-ID | <[email protected]> |
Avoid a stray unsetenv after the main thread starts servicing automounts.
One potential issue this may cause is:
main thread
main()
-> sd_notify(1, ...)
-> unsetenv()
worker thread:
lookup_program.c:lookup_one()
-> fork() # if the fork happened just before unsetenv in sd_notify,
# the envlock in glibc's setenv.c will be in a locked state.
-> macro_setenv() # in the child
-> setenv()
---
daemon/automount.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/daemon/automount.c b/daemon/automount.c
index 474b29a..51551f3 100644
--- a/daemon/automount.c
+++ b/daemon/automount.c
@@ -2739,7 +2739,7 @@ int main(int argc, char *argv[])
#ifdef WITH_SYSTEMD
if (flags & DAEMON_FLAGS_SYSTEMD_SERVICE)
- sd_notify(1, "READY=1");
+ sd_notify(0, "READY=1");
#endif
signal_handler_thid = pthread_self();
--
2.43.7