Allow for a zero length 'loader'.

This commit is contained in:
Doug Rabson 2008-04-05 10:26:20 +00:00
parent 2fbced6574
commit 8948542c2d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=177933

View File

@ -336,6 +336,8 @@ gethdr(int fd, struct hdr *hdr)
if (sb.st_size > MAXU32)
errx(1, "%s: Too big", fname);
hdr->size = sb.st_size;
if (!hdr->size)
return;
if ((p = mmap(NULL, hdr->size, PROT_READ, MAP_SHARED, fd,
0)) == MAP_FAILED)
err(2, "%s", fname);