device-mapper-multipath/0059-mpathpersist-use-atexit-for-cleanup-handlers.patch

33 lines
911 B
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Wed, 23 Sep 2020 00:32:48 +0200
Subject: [PATCH] mpathpersist: use atexit() for cleanup handlers
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
mpathpersist/main.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/mpathpersist/main.c b/mpathpersist/main.c
index 3c2e6576..14245cc3 100644
--- a/mpathpersist/main.c
+++ b/mpathpersist/main.c
@@ -641,11 +641,10 @@ int main(int argc, char *argv[])
if (libmpathpersist_init()) {
exit(1);
}
+ if (atexit((void(*)(void))libmpathpersist_exit))
+ fprintf(stderr, "failed to register cleanup handler for libmpathpersist: %m");
ret = handle_args(argc, argv, 0);
-
- libmpathpersist_exit();
-
return (ret >= 0) ? ret : MPATH_PR_OTHER;
}
--
2.17.2