device-mapper-multipath/0048-multipathd-add-helper-for-systemd-notification-at-ex.patch
Benjamin Marzinski 1dad67a5af device-mapper-multipath-0.8.5-1
Update Source to upstream version 0.8.5 plus post tag commits
  * Patches 0001-0102 are from
    https://github.com/openSUSE/multipath-tools/tree/queue and are
    already queued for upstream.
Rename files
  * Previous patches 0059-0068 are now patches 0103-0111
2021-01-19 18:06:09 -06:00

61 lines
1.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Wed, 23 Sep 2020 17:49:02 +0200
Subject: [PATCH] multipathd: add helper for systemd notification at exit
Add sd_notify_exit().
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipathd/main.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/multipathd/main.c b/multipathd/main.c
index f6b80668..07068e4a 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -3024,6 +3024,17 @@ static void cleanup_rcu(void)
rcu_unregister_thread();
}
+static int sd_notify_exit(int err)
+{
+#ifdef USE_SYSTEMD
+ char msg[24];
+
+ snprintf(msg, sizeof(msg), "ERRNO=%d", err);
+ sd_notify(0, msg);
+#endif
+ return err;
+}
+
static int
child (__attribute__((unused)) void *param)
{
@@ -3216,19 +3227,12 @@ child (__attribute__((unused)) void *param)
#ifdef _DEBUG_
dbg_free_final(NULL);
#endif
-
-#ifdef USE_SYSTEMD
- sd_notify(0, "ERRNO=0");
-#endif
- exit(0);
+ exit(sd_notify_exit(0));
failed:
-#ifdef USE_SYSTEMD
- sd_notify(0, "ERRNO=1");
-#endif
if (pid_fd >= 0)
close(pid_fd);
- exit(1);
+ exit(sd_notify_exit(1));
}
static int
--
2.17.2