]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: use _exit() in <type> handlers
authorKarel Zak <kzak@redhat.com>
Thu, 29 Jun 2017 10:58:57 +0000 (12:58 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 29 Jun 2017 10:58:57 +0000 (12:58 +0200)
The originally used exit() is bad idea for the shared library.

Reported-by: Ruediger Meier <sweet_f_a@gmx.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/src/context_mount.c
libmount/src/context_umount.c

index 2c5334217e51e34900b7fc94337cbb663a62469f..65f7dbfd028697bf736e890357246743b719b5f7 100644 (file)
@@ -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;
 }
index 0bee0278c6df04d09012811096b6330590a68cd5..f2c304f4a6cb84245af3fc031ebe1cc4486261ea 100644 (file)
@@ -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:
        {