[klibc] capabilities: Use fflush() instead of fseek()
It shouldn't use stream I/O against a control device at all
in do_usermodehelper_file(), as noted by hpa.
Stylistically rewind seems cleaner, but fflush() has error checking.
Reported-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: maximilian attems <max@stro.at>
diff --git a/usr/kinit/capabilities.c b/usr/kinit/capabilities.c
index c606144..2c61025 100644
--- a/usr/kinit/capabilities.c
+++ b/usr/kinit/capabilities.c
@@ -167,9 +167,9 @@
hi32 &= ~(1 << (cap_ordinal - 32));
/* Commit the new bit masks to the kernel */
- ret = fseek(file, 0L, SEEK_SET);
+ ret = fflush(file);
if (ret != 0)
- fail("Failed on file %s to seek %d\n", filename, ret);
+ fail("Failed on file %s to fflush %d\n", filename, ret);
sprintf(buf, "%u %u", lo32, hi32);
ret = fwrite(buf, 1, strlen(buf) + 1, file);
if (ret != 0)