]> git.ipfire.org Git - thirdparty/systemd.git/commit
fork-notify: Use callback instead of argv NULL code path with return
authorKai Lüke <kai@amutable.com>
Fri, 24 Apr 2026 15:18:56 +0000 (00:18 +0900)
committerKai Lüke <kai@amutable.com>
Mon, 27 Apr 2026 13:14:05 +0000 (22:14 +0900)
commit4dbcc319cae75233cc334556ded595636115ed47
tree19eac7ab302fd2e6b538f8b0936ba67c1b0ff88a
parentd41555dd2cb8b3bc3876edd4869b3142048393fe
fork-notify: Use callback instead of argv NULL code path with return

In 012d87c1fc/cc8f398202 it was made possible for fork_notify() to
return in the child but at that point all FDs were closed and the
_cleanup path from the return causes assertion failures due to invalid
FDs in notify_event_source/event, leading to a vmspawn failing to start
with a SIGABRT logged in coredump.
Instead of TAKE_PTR on a bunch of things which is fragile, rather avoid
the return and instead add an explicit callback handler and guarantee
to exit directly after it. A userdata argument is also added but not
used yet I think it's quite normal to have for a callback.
src/shared/fork-notify.c
src/shared/fork-notify.h
src/vmspawn/vmspawn.c