From: Lennart Poettering Date: Fri, 19 Feb 2021 17:29:13 +0000 (+0100) Subject: fileio: extend comment about file sizes in virtual file systems X-Git-Tag: v248-rc1~34 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1cf36084a7860c60d68d59b466083a79dfb2376a;p=thirdparty%2Fsystemd.git fileio: extend comment about file sizes in virtual file systems --- diff --git a/src/basic/fileio.c b/src/basic/fileio.c index 21532515fbd..15f0ffbdfa7 100644 --- a/src/basic/fileio.c +++ b/src/basic/fileio.c @@ -385,7 +385,9 @@ int read_full_virtual_file(const char *filename, char **ret_contents, size_t *re if (fd < 0) return -errno; - /* Start size for files in /proc which usually report a file size of 0. */ + /* Start size for files in /proc/ which usually report a file size of 0. (Files in /sys/ report a + * file size of 4K, which is probably OK for sizing our initial buffer, and sysfs attributes can't be + * larger anyway.) */ size = LINE_MAX / 2; /* Limit the number of attempts to read the number of bytes returned by fstat(). */