mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-28 08:12:28 +00:00
Fix some issues with zipos and redbean
- redbean.com -D /zip/dir/ now works, for pure fun - possibly fixed bug with redbean serving empty files - zipos stat() mode now indicates directories on windows See #372
This commit is contained in:
parent
4881ae7527
commit
d57f87dc40
4 changed files with 49 additions and 9 deletions
|
@ -273,6 +273,10 @@ noasan void *mmap(void *addr, size_t size, int prot, int flags, int fd,
|
|||
}
|
||||
return VIP(efault());
|
||||
}
|
||||
if (__isfdkind(fd, kFdZip)) {
|
||||
STRACE("mmap(%.12p, %'zu) EINVAL (fd is zipos handle)", p, size);
|
||||
return VIP(einval());
|
||||
}
|
||||
STRACE("mmap(%.12p, %'zu, %s, %d, %'ld)% m", p, size,
|
||||
DescribeMapping(prot, flags, mode), fd, off);
|
||||
if (fd == -1) {
|
||||
|
|
|
@ -28,12 +28,8 @@ int __zipos_stat_impl(struct Zipos *zipos, size_t cf, struct stat *st) {
|
|||
size_t lf;
|
||||
if (zipos && st) {
|
||||
bzero(st, sizeof(*st));
|
||||
if (ZIP_CFILE_FILEATTRCOMPAT(zipos->map + cf) == kZipOsUnix) {
|
||||
st->st_mode = ZIP_CFILE_EXTERNALATTRIBUTES(zipos->map + cf) >> 16;
|
||||
} else {
|
||||
st->st_mode = 0100644;
|
||||
}
|
||||
lf = GetZipCfileOffset(zipos->map + cf);
|
||||
st->st_mode = GetZipCfileMode(zipos->map + cf);
|
||||
st->st_size = GetZipLfileUncompressedSize(zipos->map + lf);
|
||||
st->st_blocks =
|
||||
roundup(GetZipLfileCompressedSize(zipos->map + lf), 512) / 512;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue