aboutsummaryrefslogtreecommitdiff
path: root/lib/lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/lib.c')
-rw-r--r--lib/lib.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/lib.c b/lib/lib.c
index 7f4413ad..58670921 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -325,6 +325,8 @@ char *readfile(char *name)
fd = open(name, O_RDONLY);
if (fd == -1) return 0;
len = fdlength(fd);
+ // proc files don't report a length, so try 1 page minimum.
+ if (len<4096) len = 4095;
buf = xmalloc(len+1);
buf[readall(fd, buf, len)] = 0;