From bc4d4b7f35424ed11319481f90fb16d1288275f8 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Wed, 24 Feb 2021 09:52:34 +0100 Subject: [PATCH] plugins: pidfile: set up I/O callback on successful iwatch_init() In case of trouble, make sure we don't have a callback set up w/o a valid file descriptor. Signed-off-by: Joachim Wiberg --- plugins/pidfile.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/plugins/pidfile.c b/plugins/pidfile.c index 88bfce66..e2a55023 100644 --- a/plugins/pidfile.c +++ b/plugins/pidfile.c @@ -273,10 +273,6 @@ static plugin_t plugin = { .name = __FILE__, .hook[HOOK_BASEFS_UP] = { .cb = pidfile_init }, .hook[HOOK_SVC_RECONF] = { .cb = pidfile_reconf }, - .io = { - .cb = pidfile_callback, - .flags = PLUGIN_IO_READ, - }, .depends = { "netlink" }, }; @@ -289,6 +285,9 @@ PLUGIN_INIT(plugin_init) return; plugin.io.fd = fd; + plugin.io.cb = pidfile_callback; + plugin.io.flags = PLUGIN_IO_READ; + plugin_register(&plugin); }