aboutsummaryrefslogtreecommitdiff
path: root/lib/lib.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2013-08-27 23:48:54 -0500
committerRob Landley <rob@landley.net>2013-08-27 23:48:54 -0500
commit455865a837f2a6c44f91e5a5a2cd40c3a64d4b68 (patch)
tree6eb787bd75914d35c7d742e02dc7be9c279d3d03 /lib/lib.c
parent8b5c671958071ee2a9967551f0490623b73e30b5 (diff)
downloadtoybox-455865a837f2a6c44f91e5a5a2cd40c3a64d4b68.tar.gz
Rewrite pmap to be simpler and match other implementation's output more closely.
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;