sysctl: disable buffer while writing to /proc

fputs() writes only first 2048 bytes and fails
to write to /proc when values are larger than that.
This patch adds a new flag to WriteStringFileFlags
that make it possible to disable the buffer under
specific cases.
This commit is contained in:
Tiago Salem Herrmann
2017-12-13 15:03:41 -02:00
parent a668bfe88a
commit 12ec9c3099
3 changed files with 5 additions and 1 deletions
+3
View File
@@ -167,6 +167,9 @@ int write_string_file_ts(
}
}
if (flags & WRITE_STRING_FILE_DISABLE_BUFFER)
setvbuf(f, NULL, _IONBF, 0);
r = write_string_stream_ts(f, line, flags, ts);
if (r < 0)
goto fail;