]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/core/main.c
core: use raw_clone instead of fork in signal handler
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 17 Dec 2014 04:53:23 +0000 (23:53 -0500)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 18 Dec 2014 05:52:41 +0000 (00:52 -0500)
commitee05e7795bb9ad7d1212dd49ad362f3e9603c4fd
tree54b417af3285979aef08af98d50e81b851c9b256
parent503dbda6d94c16161762b7b489677a377f235590
core: use raw_clone instead of fork in signal handler

fork() is not async-signal-safe and calling it from the signal handler
could result in a deadlock when at_fork() handlers are called. Using
the raw clone() syscall sidesteps that problem.

The tricky part is that raise() does not work, since getpid() does not
work. Add raw_getpid() to get the real pid, and use kill() instead of
raise().

https://bugs.freedesktop.org/show_bug.cgi?id=86604
src/core/main.c
src/shared/missing.h
src/test/test-util.c