]> git.tuebingen.mpg.de Git - dss.git/commit
Properly invalidate create_pid also for the post-create hook.
authorAndre Noll <maan@systemlinux.org>
Fri, 28 Aug 2009 13:23:57 +0000 (15:23 +0200)
committerAndre Noll <maan@systemlinux.org>
Fri, 28 Aug 2009 13:23:57 +0000 (15:23 +0200)
commit64964f0639b13787a06bea76f922cba18731807c
treefc23588d96472940d5ed1e4e4bde7f087b082b2b
parent67f36528afce8e7dd5016283eb3da5a99be4778d
Properly invalidate create_pid also for the post-create hook.

If the process associated with the create_pid dies, handle_sigchld()
investigates snapshot_creation_status to tell whether the pre-create
hook, the rsync process or the post-create hook has died.

In the first two cases, handle_pre_create_hook_exit() and
handle_rsync_exit() are called, respectively. Both functions correctly
invalidate create_pid (by resetting it to zero).

However, the post-create hook handling code misses to reset
create_pid. This causes dss to send SIGTERM to this pid on exit,
which might be fatal as the pid might have been reassigned to some
unrelated process in the meanwhile.

Fix this bug by moving the invalidation of create_pid to the end of
the "if (pid == create_pid)" clause, which even saves a line of code.

Many thanks to Sebastian Stark who pointed out that bug.
dss.c