diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/lib.h | 2 | ||||
-rw-r--r-- | lib/xwrap.c | 6 |
2 files changed, 4 insertions, 4 deletions
@@ -102,7 +102,7 @@ size_t xread(int fd, void *buf, size_t len); void xreadall(int fd, void *buf, size_t len); void xwrite(int fd, void *buf, size_t len); off_t xlseek(int fd, off_t offset, int whence); -char *xreadfile(char *name); +char *xreadfile(char *name, char *buf, off_t len); int xioctl(int fd, int request, void *data); char *xgetcwd(void); void xstat(char *path, struct stat *st); diff --git a/lib/xwrap.c b/lib/xwrap.c index 08a93ddf..ae296cd6 100644 --- a/lib/xwrap.c +++ b/lib/xwrap.c @@ -451,10 +451,10 @@ char *xreadlink(char *name) } } -char *xreadfile(char *name) +char *xreadfile(char *name, char *buf, off_t len) { - char *buf = readfile(name, 0, 0); - if (!buf) perror_exit("xreadfile %s", name); + if (!(buf = readfile(name, buf, len))) perror_exit("Bad '%s'", name); + return buf; } |