]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
fileio: extend comment about file sizes in virtual file systems
authorLennart Poettering <lennart@poettering.net>
Fri, 19 Feb 2021 17:29:13 +0000 (18:29 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 19 Feb 2021 17:29:13 +0000 (18:29 +0100)
src/basic/fileio.c

index 21532515fbd7f6c1bac715336f02022c3dde9ccb..15f0ffbdfa7b34db418fa0483c3b991063ecc47e 100644 (file)
@@ -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(). */