Fix race condition in doord restart

Signed-off-by: Paul Brook <paul@nowt.org>