[PATCH 31/33] setpriv: check writing to a file descriptor was successful

Sami Kerola
2013-04-13T19:56:34Z

sys-utils/setpriv.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sys-utils/setpriv.c b/sys-utils/setpriv.c
index 18810c5..4a44106 100644
--- a/sys-utils/setpriv.c
+++ b/sys-utils/setpriv.c
@@ -526,7 +526,9 @@ static void do_selinux_label(const char *label)
err(SETPRIV_EXIT_PRIVERR,
_("write failed: %s"), _PATH_PROC_ATTR_EXEC);

- close(fd);
+ if (close_fd(fd) != 0)
+ err(SETPRIV_EXIT_PRIVERR,
+ _("write failed: %s"), _PATH_PROC_ATTR_EXEC);
}

static void do_apparmor_profile(const char *label)
--
1.8.2.1