agent: Fix a race condition which results accessing finished scd.
* agent/call-daemon.c (daemon_start): Decision of connection/reuse of CTX and assignment to ->ctx should be done with the lock.
When scdaemon is exiting and agent tries to spawn/connect/reconnect,
there is a race condition between detecting finish of scd and
spawn/connect/reconnect.
- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>