klibc-bot for maximilian attems
2012-May-29 17:12 UTC
[klibc] [klibc:master] capabilities: Use fflush() instead of fseek ()
Commit-ID: 163920f31f98db13f4e37796bb92f0844e7aaf45 Gitweb: http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=163920f31f98db13f4e37796bb92f0844e7aaf45 Author: maximilian attems <max at stro.at> AuthorDate: Tue, 29 May 2012 18:58:31 +0200 Committer: maximilian attems <max at stro.at> CommitDate: Tue, 29 May 2012 19:03:08 +0200 [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 at zytor.com> Signed-off-by: maximilian attems <max at stro.at> --- usr/kinit/capabilities.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) 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 @@ static void do_usermodehelper_file(const char *filename, int cap_ordinal) 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)
Apparently Analagous Threads
- [klibc:master] kinit: Fix capabilities alternate read/ write io without flush
- [PATCH v2] kinit: Add drop_capabilities support.
- [PATCH] klibc: fix capability dropping
- [PATCH v1 0/2] Support dropping of capabilities from early userspace.
- [LLVMdev] Instructions working on 64bit registers without true support for 64bit operations