about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2018-01-14 22:59:51 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2018-01-14 22:59:51 +0000
commit95ac7f17e2261158c793421603490c13e24efef3 (patch)
treec9916cfec54cc6dc39b5992aaeca79891d953c48
parenta9d10d4ce41395923f52114f722dd02d9c732c81 (diff)
downloadmdevd-95ac7f17e2261158c793421603490c13e24efef3.tar.gz
mdevd-95ac7f17e2261158c793421603490c13e24efef3.tar.xz
mdevd-95ac7f17e2261158c793421603490c13e24efef3.zip
Only send readiness notification after the first config file read
-rw-r--r--src/mdevd/mdevd.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/mdevd/mdevd.c b/src/mdevd/mdevd.c
index 1715f27..4bfa558 100644
--- a/src/mdevd/mdevd.c
+++ b/src/mdevd/mdevd.c
@@ -1032,7 +1032,6 @@ int main (int argc, char const *const *argv)
 
   x[1].fd = netlink_init(kbufsz) ;
   if (x[1].fd < 0) strerr_diefu1sys(111, "init netlink") ;
-
   x[0].fd = selfpipe_init() ;
   if (x[0].fd < 0) strerr_diefu1sys(111, "init selfpipe") ;
   if (sig_ignore(SIGPIPE) < 0) strerr_diefu1sys(111, "ignore SIGPIPE") ;
@@ -1048,12 +1047,6 @@ int main (int argc, char const *const *argv)
   mdevd_random_init() ;
   umask(0) ;
 
-  if (notif)
-  {
-    fd_write(notif, "\n", 1) ;
-    fd_close(notif) ;
-  }
-
   while (cont)
   {
     ssize_t len ;
@@ -1077,6 +1070,12 @@ int main (int argc, char const *const *argv)
       script[scriptlen++] = scriptelem_catchall ;
       script_secondpass(storage, script, envmatch) ;
       cont = 2 ;
+      if (notif)
+      {
+        fd_write(notif, "\n", 1) ;
+        fd_close(notif) ;
+        notif = 0 ;
+      }
 
       while (pid || cont == 2)
       {