From 41d758f82d2e5e0a3f5c87c58cb3ca4eacc80d9b Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 29 Jun 2017 12:58:57 +0200 Subject: [PATCH] libmount: use _exit() in handlers The originally used exit() is bad idea for the shared library. Reported-by: Ruediger Meier Signed-off-by: Karel Zak --- libmount/src/context_mount.c | 8 ++++---- libmount/src/context_umount.c | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c index 2c5334217e..65f7dbfd02 100644 --- a/libmount/src/context_mount.c +++ b/libmount/src/context_mount.c @@ -597,10 +597,10 @@ static int exec_helper(struct libmnt_context *cxt) int i = 0; if (setgid(getgid()) < 0) - exit(EXIT_FAILURE); + _exit(EXIT_FAILURE); if (setuid(getuid()) < 0) - exit(EXIT_FAILURE); + _exit(EXIT_FAILURE); type = mnt_fs_get_fstype(cxt->fs); @@ -632,7 +632,7 @@ static int exec_helper(struct libmnt_context *cxt) i, args[i])); DBG_FLUSH; execv(cxt->helper, (char * const *) args); - exit(EXIT_FAILURE); + _exit(EXIT_FAILURE); } default: { @@ -1244,7 +1244,7 @@ int mnt_context_next_mount(struct libmnt_context *cxt, if (mnt_context_is_child(cxt)) { DBG(CXT, ul_debugobj(cxt, "next-mount: child exit [rc=%d]", rc)); DBG_FLUSH; - exit(rc); + _exit(rc); } return 0; } diff --git a/libmount/src/context_umount.c b/libmount/src/context_umount.c index 0bee0278c6..f2c304f4a6 100644 --- a/libmount/src/context_umount.c +++ b/libmount/src/context_umount.c @@ -543,10 +543,10 @@ static int exec_helper(struct libmnt_context *cxt) int i = 0; if (setgid(getgid()) < 0) - exit(EXIT_FAILURE); + _exit(EXIT_FAILURE); if (setuid(getuid()) < 0) - exit(EXIT_FAILURE); + _exit(EXIT_FAILURE); type = mnt_fs_get_fstype(cxt->fs); @@ -576,7 +576,7 @@ static int exec_helper(struct libmnt_context *cxt) i, args[i])); DBG_FLUSH; execv(cxt->helper, (char * const *) args); - exit(EXIT_FAILURE); + _exit(EXIT_FAILURE); } default: { -- 2.47.3