wait for DMAPI to startup
authorAndrew Tridgell <tridge@samba.org>
Sun, 17 Aug 2008 23:15:08 +0000 (09:15 +1000)
committerAndrew Tridgell <tridge@samba.org>
Sun, 17 Aug 2008 23:15:08 +0000 (09:15 +1000)
hacksmd.c

index 3ef4bf1fdc0861c34ddce28148cf365c5792d2a6..bf6854cff96ced5e154e049e4a71fc1b0b737d8e 100644 (file)
--- a/hacksmd.c
+++ b/hacksmd.c
@@ -23,6 +23,8 @@ static struct {
 
 #define SESSION_NAME "hacksmd"
 
+/* no special handling on terminate in hacksmd, as we want existing
+   events to stay around so we can continue them on restart */
 static void hsm_term_handler(int signal)
 {
        printf("Got signal %d - exiting\n", signal);
@@ -42,8 +44,13 @@ static void hsm_init(void)
        int ret;
 
        ret = dm_init_service(&dmapi_version);
+       if (ret == -1 && errno == ENOSYS) {
+               printf("Waiting for DMAPI to initialise\n");
+               while ((ret = dm_init_service(&dmapi_version)) == -1 &&
+                      errno == ENOSYS) sleep(1);
+       }
        if (ret != 0) {
-               printf("Failed to init dmapi\n");
+               printf("Failed to init dmapi (%s)\n", strerror(errno));
                exit(1);
        }