nbd-server: fix signal handling
authorDmitry V. Levin <ldv@altlinux.org>
Thu, 21 Jun 2012 21:46:04 +0000 (01:46 +0400)
committerWouter Verhelst <w@uter.be>
Sat, 23 Jun 2012 23:38:35 +0000 (01:38 +0200)
commit22b693e410b0c314f879f437d654c76aeadb97e5
treeaa1fcdd6935d1484bd7a9189f16dd5a09130282e
parent463c8bcf4e638bceb75e33ae3a419f93f1e52a68
nbd-server: fix signal handling

Reset SIGCHLD and SIGTERM handlers to SIG_DFL in child processes because
it is not their business to handle these signals.  Block SIGCHLD and
SIGTERM for the short time of fork, changing signal handlers and
changing "children" hash table to avoid race conditions with nasty
consequences.  Fix SIGTERM handler to always unlink pidfile.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
nbd-server.c