[dm-devel] [PATCH 21/23] mpathpersist: use atexit() for cleanup handlers
mwilck at suse.com
mwilck at suse.com
Thu Sep 24 13:40:52 UTC 2020
From: Martin Wilck <mwilck at suse.com>
Signed-off-by: Martin Wilck <mwilck at suse.com>
---
mpathpersist/main.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/mpathpersist/main.c b/mpathpersist/main.c
index 3c2e657..14245cc 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.28.0
More information about the dm-devel
mailing list