[OpenWrt-Devel,3/7] procd: skip respawn in case device disappeared

Message ID b5aaa82470ac71803f1fe4d36a5fc3ae85349f2d.1546385477.git.mhei@heimpold.de
State New
Headers show
Series
  • procd: console hotplugging support
Related show

Commit Message

Michael Heimpold Jan. 1, 2019, 11:44 p.m.
Signed-off-by: Michael Heimpold <mhei@heimpold.de>
---
 inittab.c | 5 +++++
 1 file changed, 5 insertions(+)

Patch

diff --git a/inittab.c b/inittab.c
index b8552e9..18023f5 100644
--- a/inittab.c
+++ b/inittab.c
@@ -123,6 +123,11 @@  static void child_exit(struct uloop_process *proc, int ret)
 	DEBUG(4, "pid:%d, exitcode:%d\n", proc->pid, ret);
 	proc->pid = 0;
 
+	if (!dev_exist(a->id)) {
+		DEBUG(4, "Skipping respawn: device '%s' does not exist anymore\n", a->id);
+		return;
+	}
+
 	uloop_timeout_set(&a->tout, a->respawn);
 }