From f906bb357a243ee297cf0c42c11b5704cd2e334e Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Wed, 24 Feb 2021 12:28:45 +0100 Subject: [PATCH] plugins: pidfile: only scan directory if watch added successfully Also, update condition example in comment. Signed-off-by: Joachim Wiberg --- plugins/pidfile.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/pidfile.c b/plugins/pidfile.c index e2a55023..b525952f 100644 --- a/plugins/pidfile.c +++ b/plugins/pidfile.c @@ -138,8 +138,8 @@ static void pidfile_handle_dir(struct iwatch *iw, char *dir, char *name, int mas if (mask & IN_CREATE) { if (!iwp) { - pidfile_add_path(iw, path); - pidfile_scandir(iw, path, sizeof(path)); + if (!pidfile_add_path(iw, path)) + pidfile_scandir(iw, path, sizeof(path)); } } else if (mask & IN_DELETE) { if (iwp) @@ -265,9 +265,9 @@ static void pidfile_init(void *arg) * * service /sbin/dropbear ... * - * Which provides the condition, will not be - * set by pidfile.so during `initctl reload` because dropbear is - * still SIGSTP:ed waiting for . + * Which provides the condition, will not be set by + * pidfile.so during `initctl reload` because dropbear is still + * SIGSTP:ed waiting for . */ static plugin_t plugin = { .name = __FILE__,