Unlock the master socket if the boot thread terminates early.
Avoid crash if thread died during timeout wakeup.

diff --git a/server/thread.c b/server/thread.c
index ecb9870..bc0833c 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -211,6 +211,12 @@
     thread->request_fd = -1;
     thread->reply_fd = -1;
     thread->wait_fd = -1;
+
+    if (thread == booting_thread)  /* killing booting thread */
+    {
+        booting_thread = NULL;
+        lock_master_socket(0);
+    }
 }
 
 /* destroy a thread when its refcount is 0 */
@@ -479,7 +485,7 @@
     if (debug_level) fprintf( stderr, "%08x: *wakeup* signaled=%d cookie=%p\n",
                               (unsigned int)thread, STATUS_TIMEOUT, cookie );
     end_wait( thread );
-    send_thread_wakeup( thread, cookie, STATUS_TIMEOUT );
+    if (send_thread_wakeup( thread, cookie, STATUS_TIMEOUT ) == -1) return;
     /* check if other objects have become signaled in the meantime */
     wake_thread( thread );
 }