From 455865a837f2a6c44f91e5a5a2cd40c3a64d4b68 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Tue, 27 Aug 2013 23:48:54 -0500 Subject: Rewrite pmap to be simpler and match other implementation's output more closely. --- lib/lib.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib') 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; -- cgit v1.2.3