]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
setpriv: Fix --selinux-label
authorAndy Lutomirski <luto@amacapital.net>
Thu, 1 May 2014 05:10:13 +0000 (22:10 -0700)
committerKarel Zak <kzak@redhat.com>
Tue, 6 May 2014 09:27:52 +0000 (11:27 +0200)
This commit:

    commit 05cef8eafbf169a8da1d2831f5ed3d5b1b81aaad
    Author: Sami Kerola <kerolasa@iki.fi>
    Date:   Sat Apr 13 20:54:59 2013 +0100

        setpriv: check writing to a file descriptor was successful

broke --selinux-label.  It checks whether fsyncing /proc/self/attr/exec
succeeds, and it doesn't, because fsync isn't supported on that file.

I have stealthily improved the error message as part of this fix.

Signed-off-by: Andy Lutomirski <luto@amacapital.net>
sys-utils/setpriv.c

index 7bea6264953ae8d247bd77665b29357a8ee3668f..65921be18bcdc20b7b6cd4d42a03ca7edcc7f797 100644 (file)
@@ -526,9 +526,9 @@ static void do_selinux_label(const char *label)
                err(SETPRIV_EXIT_PRIVERR,
                    _("write failed: %s"), _PATH_PROC_ATTR_EXEC);
 
-       if (close_fd(fd) != 0)
+       if (close(fd) != 0)
                err(SETPRIV_EXIT_PRIVERR,
-                   _("write failed: %s"), _PATH_PROC_ATTR_EXEC);
+                   _("close failed: %s"), _PATH_PROC_ATTR_EXEC);
 }
 
 static void do_apparmor_profile(const char *label)