setpriv: Fix --selinux-label

This commit:

    commit 05cef8eafb
    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>
This commit is contained in:
Andy Lutomirski 2014-04-30 22:10:13 -07:00 committed by Karel Zak
parent aa06617f6e
commit cc89383b32
1 changed files with 2 additions and 2 deletions

View 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)