diff options
author | maximilian attems <max@stro.at> | 2012-05-29 18:58:31 +0200 |
---|---|---|
committer | maximilian attems <max@stro.at> | 2012-05-29 19:03:08 +0200 |
commit | 163920f31f98db13f4e37796bb92f0844e7aaf45 (patch) | |
tree | 3471a97ad91883bcb072e508860a130a2ec52b86 | |
parent | 8544fef6d5e5bc8f927ffbd3e4031b905c907de9 (diff) | |
download | klibc-163920f31f98db13f4e37796bb92f0844e7aaf45.tar.gz |
[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>
-rw-r--r-- | 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 c60614487fff3c..2c61025fc6afcc 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) |