summaryrefslogtreecommitdiff
path: root/src/basic/fileio.c
diff options
context:
space:
mode:
authorTiago Salem Herrmann <therrmann@suse.com>2017-12-12 13:52:45 -0200
committerTiago Salem Herrmann <therrmann@suse.com>2017-12-13 15:03:41 -0200
commit12ec9c309967d663e93254e3fca835f9a240e26f (patch)
tree81f8d3f5218b972abbea39789ab4a23e7ca825f4 /src/basic/fileio.c
parenta668bfe88a48d433a81dad8219bd98fc73838eda (diff)
downloadsystemd-12ec9c309967d663e93254e3fca835f9a240e26f.tar.gz
systemd-12ec9c309967d663e93254e3fca835f9a240e26f.tar.bz2
systemd-12ec9c309967d663e93254e3fca835f9a240e26f.zip
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.
Diffstat (limited to 'src/basic/fileio.c')
-rw-r--r--src/basic/fileio.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/basic/fileio.c b/src/basic/fileio.c
index 12d6d06fa2..76c9333d26 100644
--- a/src/basic/fileio.c
+++ b/src/basic/fileio.c
@@ -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;