From 12f0744f340746b3a1c1accfdf993d6548f33e56 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Tue, 23 May 2017 17:35:49 -0700 Subject: Add and use xmmap. Everyone forgets that mmap returns MAP_FAILED rather than NULL on failure. Every use of mmap in toybox was either doing the wrong check, or no check at all (including the two I personally added). --- lib/lib.h | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/lib.h') diff --git a/lib/lib.h b/lib/lib.h index effba9b4..0b93bde9 100644 --- a/lib/lib.h +++ b/lib/lib.h @@ -115,6 +115,7 @@ void xstrncpy(char *dest, char *src, size_t size); void xstrncat(char *dest, char *src, size_t size); void _xexit(void) noreturn; void xexit(void) noreturn; +void *xmmap(void *addr, size_t length, int prot, int flags, int fd, off_t off); void *xmalloc(size_t size); void *xzalloc(size_t size); void *xrealloc(void *ptr, size_t size); -- cgit v1.2.3