[klibc] [klibc:master] kinit: Fix capabilities alternate read/ write io without flush

klibc-bot for maximilian attems max at stro.at
Sun May 27 14:24:04 PDT 2012


Commit-ID:  8544fef6d5e5bc8f927ffbd3e4031b905c907de9
Gitweb:     http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=8544fef6d5e5bc8f927ffbd3e4031b905c907de9
Author:     maximilian attems <max at stro.at>
AuthorDate: Sun, 27 May 2012 23:18:07 +0200
Committer:  maximilian attems <max at stro.at>
CommitDate: Sun, 27 May 2012 23:18:07 +0200

[klibc] kinit: Fix capabilities alternate read/write io without flush

Just fseek back to the start.

Signed-off-by: maximilian attems <max at stro.at>

---
 usr/kinit/capabilities.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/usr/kinit/capabilities.c b/usr/kinit/capabilities.c
index eab4d93..c606144 100644
--- a/usr/kinit/capabilities.c
+++ b/usr/kinit/capabilities.c
@@ -167,6 +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);
+	if (ret != 0)
+		fail("Failed on file %s to seek %d\n", filename, ret);
 	sprintf(buf, "%u %u", lo32, hi32);
 	ret = fwrite(buf, 1, strlen(buf) + 1, file);
 	if (ret != 0)


More information about the klibc mailing list