mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-28 00:02:28 +00:00
Make ZipOS and Qemu work better
This change improves the dirstream library in a lot of respects, especially for /zip/... files. Also turn off MAP_STACK on Aarch64 because Qemu seems to implement it differently than Linux and it's probably responsible for a lot of mysterious crashes.
This commit is contained in:
parent
4658ae539f
commit
110559ce6a
48 changed files with 748 additions and 500 deletions
|
@ -22,8 +22,11 @@
|
|||
#include "libc/limits.h"
|
||||
#include "libc/log/check.h"
|
||||
#include "libc/mem/gc.h"
|
||||
#include "libc/mem/gc.internal.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/nexgen32e/crc32.h"
|
||||
#include "libc/nt/enum/fileflagandattributes.h"
|
||||
#include "libc/runtime/zipos.internal.h"
|
||||
#include "libc/stdio/rand.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/sysv/consts/s.h"
|
||||
|
@ -130,7 +133,7 @@ static void EmitZipCdirHdr(unsigned char *p, const void *name, size_t namesize,
|
|||
/**
|
||||
* Embeds zip file in elf object.
|
||||
*/
|
||||
void elfwriter_zip(struct ElfWriter *elf, const char *symbol, const char *name,
|
||||
void elfwriter_zip(struct ElfWriter *elf, const char *symbol, const char *cname,
|
||||
size_t namesize, const void *data, size_t size,
|
||||
uint32_t mode, struct timespec mtim, struct timespec atim,
|
||||
struct timespec ctim, bool nocompress) {
|
||||
|
@ -144,6 +147,13 @@ void elfwriter_zip(struct ElfWriter *elf, const char *symbol, const char *name,
|
|||
|
||||
CHECK_NE(0, mtim.tv_sec);
|
||||
|
||||
char *name = gc(strndup(cname, namesize));
|
||||
namesize = __zipos_normpath(name);
|
||||
if (S_ISDIR(mode) && namesize && name[namesize - 1] != '/') {
|
||||
name[namesize++] = '/';
|
||||
name[namesize] = 0;
|
||||
}
|
||||
|
||||
gflags = 0;
|
||||
iattrs = 0;
|
||||
compsize = size;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue