X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5e9f25245196606cd95bf05897c1d6720f6db081..d7c37bdf337d7ca687263520de432eee4a3722db:/src/expat/xmlwf/unixfilemap.c diff --git a/src/expat/xmlwf/unixfilemap.c b/src/expat/xmlwf/unixfilemap.c index 22048c82ed..93adce32e8 100644 --- a/src/expat/xmlwf/unixfilemap.c +++ b/src/expat/xmlwf/unixfilemap.c @@ -44,6 +44,13 @@ filemap(const char *name, } nbytes = sb.st_size; + /* mmap fails for zero length files */ + if (nbytes == 0) { + static const char c = '\0'; + processor(&c, 0, name, arg); + close(fd); + return 1; + } p = (void *)mmap((caddr_t)0, (size_t)nbytes, PROT_READ, MAP_FILE|MAP_PRIVATE, fd, (off_t)0); if (p == (void *)-1) {