summary refs log tree commit diff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-10-23 07:20:44 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-10-23 07:20:44 +0000
commitcabc5a11701d3ccc4eeb0e01687e8cd26718aad4 (patch)
tree2c5e59c8fd08a4c4cd2882af8944803add151827
parentedb17cf415fac5f70e00dd86802adb49d1e5ca06 (diff)
downloadmdevd-cabc5a11701d3ccc4eeb0e01687e8cd26718aad4.tar.gz
mdevd-cabc5a11701d3ccc4eeb0e01687e8cd26718aad4.tar.xz
mdevd-cabc5a11701d3ccc4eeb0e01687e8cd26718aad4.zip
Only reload when it's safe; credit mixi; doc dep to skalibs-2.6.0.2
-rw-r--r--AUTHORS1
-rw-r--r--INSTALL2
-rw-r--r--doc/index.html2
-rw-r--r--src/mdevd/mdevd.c10
4 files changed, 9 insertions, 6 deletions
diff --git a/AUTHORS b/AUTHORS
index 8d69cec..645754f 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -4,3 +4,4 @@ Main author:
 Thanks to:
   Rob Landley <rob@landley.net>
   Natanael Copa <ncopa@alpinelinux.org>
+  Johannes Nixdorf <mixi@shadowice.org>
diff --git a/INSTALL b/INSTALL
index ca073f2..7385164 100644
--- a/INSTALL
+++ b/INSTALL
@@ -6,7 +6,7 @@ Build Instructions
 
   - A Linux-based system with a standard C development environment
   - GNU make version 3.81 or later
-  - skalibs version 2.6.0.0 or later: http://skarnet.org/software/skalibs/
+  - skalibs version 2.6.0.2 or later: http://skarnet.org/software/skalibs/
 
  This software is Linux-specific. It will run on a Linux kernel,
 version 2.6.10 or later.
diff --git a/doc/index.html b/doc/index.html
index 91c01d3..c11b508 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -53,7 +53,7 @@ entirely compatible with advanced mdev usage such as
 The Linux kernel must be 2.6.10 or later. </li>
  <li> GNU make, version 3.81 or later </li>
  <li> <a href="//skarnet.org/software/skalibs/">skalibs</a> version
-2.6.0.0 or later. It's a build-time requirement. It's also a run-time
+2.6.0.2 or later. It's a build-time requirement. It's also a run-time
 requirement if you link against the shared version of the skalibs
 library. </li>
 </ul>
diff --git a/src/mdevd/mdevd.c b/src/mdevd/mdevd.c
index 6784323..403c94d 100644
--- a/src/mdevd/mdevd.c
+++ b/src/mdevd/mdevd.c
@@ -957,7 +957,7 @@ int main (int argc, char const *const *argv)
   mdevd_random_init() ;
   umask(0) ;
 
-  while (cont || pid)
+  while (cont)
   {
     ssize_t len ;
     unsigned short scriptlen = 0 ;
@@ -975,23 +975,25 @@ int main (int argc, char const *const *argv)
 
     {
       size_t w = 0 ;
+      int reload = 0 ;
       struct uevent_s event = UEVENT_ZERO ;
       struct envmatch_s envmatch[envmatchlen ? envmatchlen : 1] ;
       scriptelem script[scriptlen + 1] ;
       memset(script, 0, scriptlen * sizeof(scriptelem)) ;
       script[scriptlen++] = scriptelem_catchall ;
       script_secondpass(buf, script, envmatch) ;
-      while (cont || pid)
+      while (pid || (cont && (!reload || buffer_len(buffer_0))))
       {
         if (buffer_len(buffer_0)) handle_stdin(&event, script, scriptlen, buf, envmatch, &w) ;
         x[1].events = pid ? 0 : IOPAUSE_READ ;
         if (iopause(x, 1 + cont, 0, 0) < 0) strerr_diefu1sys(111, "iopause") ;
-        if (x[0].revents & IOPAUSE_READ && handle_signals()) break ;
+        if (x[0].revents & IOPAUSE_READ && handle_signals()) reload = 1 ;
         if (cont && !pid && x[1].revents & IOPAUSE_READ)
           handle_stdin(&event, script, scriptlen, buf, envmatch, &w) ;
       }
       script_free(script, scriptlen, envmatch, envmatchlen) ;
     }
-  } 
+  }
+  ndelay_off(0) ;
   return 0 ;
 }