summaryrefslogtreecommitdiffstats
path: root/sys-utils/setpriv.c
diff options
context:
space:
mode:
authorSami Kerola2013-04-13 21:54:39 +0200
committerKarel Zak2013-04-26 13:26:06 +0200
commitf99b58b3841888703ef41802256b913abd4e3e89 (patch)
tree9e02bfbb7db5e06c447bd3df98f55438fac0fc2d /sys-utils/setpriv.c
parentcfdisk: check writing to a file was successful (diff)
downloadkernel-qcow2-util-linux-f99b58b3841888703ef41802256b913abd4e3e89.tar.gz
kernel-qcow2-util-linux-f99b58b3841888703ef41802256b913abd4e3e89.tar.xz
kernel-qcow2-util-linux-f99b58b3841888703ef41802256b913abd4e3e89.zip
setpriv: check writing to a file was successful
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'sys-utils/setpriv.c')
-rw-r--r--sys-utils/setpriv.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys-utils/setpriv.c b/sys-utils/setpriv.c
index 743fd9218..ab3180ac5 100644
--- a/sys-utils/setpriv.c
+++ b/sys-utils/setpriv.c
@@ -541,8 +541,9 @@ static void do_apparmor_profile(const char *label)
err(SETPRIV_EXIT_PRIVERR,
_("cannot open %s"), _PATH_PROC_ATTR_EXEC);
- if (fprintf(f, "changeprofile %s", label) < 0 || fflush(f) != 0
- || fclose(f) != 0)
+ fprintf(f, "changeprofile %s", label);
+
+ if (close_stream(f) != 0)
err(SETPRIV_EXIT_PRIVERR,
_("write failed: %s"), _PATH_PROC_ATTR_EXEC);
}