diff --git a/Makefile b/Makefile index fbc151323..e12ecb17b 100644 --- a/Makefile +++ b/Makefile @@ -131,7 +131,6 @@ include libc/tinymath/tinymath.mk # │ You can issue raw system calls include libc/str/str.mk # │ include third_party/xed/xed.mk # │ include third_party/puff/puff.mk # │ -include third_party/zlib/zlib.mk # │ include libc/elf/elf.mk # │ include ape/ape.mk # │ include libc/fmt/fmt.mk # │ @@ -147,6 +146,7 @@ include third_party/gdtoa/gdtoa.mk # ├──DYNAMIC RUNTIME include third_party/nsync/mem/mem.mk # │ You can now use stdio include libc/thread/thread.mk # │ You can finally call malloc() include tool/hello/hello.mk # │ +include third_party/zlib/zlib.mk # │ include libc/stdio/stdio.mk # │ include libc/time/time.mk # │ include net/net.mk # │ diff --git a/test/libc/calls/mkdir_test.c b/test/libc/calls/mkdir_test.c index 6f9b4015a..8ab1bd86f 100644 --- a/test/libc/calls/mkdir_test.c +++ b/test/libc/calls/mkdir_test.c @@ -26,6 +26,7 @@ #include "libc/runtime/runtime.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" +#include "libc/sysv/consts/at.h" #include "libc/sysv/consts/o.h" #include "libc/testlib/testlib.h" #include "libc/x/x.h" @@ -77,10 +78,14 @@ TEST(mkdir, enametoolong) { EXPECT_SYS(ENAMETOOLONG, -1, mkdir(s, 0644)); } -TEST(makedirs, testEmptyString_ENOENT) { +TEST(mkdir, testEmptyString_ENOENT) { EXPECT_SYS(ENOENT, -1, mkdir("", 0755)); } +TEST(mkdir, slashSlash) { + EXPECT_SYS(0, 0, mkdirat(AT_FDCWD, "o//", 0777)); +} + TEST(mkdirat, testRelativePath_opensRelativeToDirFd) { int dirfd; ASSERT_SYS(0, 0, mkdir("foo", 0755)); diff --git a/third_party/zlib/zlib.mk b/third_party/zlib/zlib.mk index c6e19c1b3..1fbfb6c69 100644 --- a/third_party/zlib/zlib.mk +++ b/third_party/zlib/zlib.mk @@ -19,6 +19,7 @@ THIRD_PARTY_ZLIB_A_CHECKS = \ THIRD_PARTY_ZLIB_A_DIRECTDEPS = \ LIBC_INTRIN \ LIBC_NEXGEN32E \ + LIBC_MEM \ LIBC_STR \ LIBC_SYSV diff --git a/third_party/zlib/zutil.c b/third_party/zlib/zutil.c index d6220db6e..98150040a 100644 --- a/third_party/zlib/zutil.c +++ b/third_party/zlib/zutil.c @@ -313,11 +313,7 @@ voidpf ZLIB_INTERNAL zcalloc (opaque, items, size) unsigned size; { (void)opaque; - if (_weaken(malloc)) { - return _weaken(malloc)(items * size); - } else { - return 0; - } + return malloc(items * size); } void ZLIB_INTERNAL zcfree (opaque, ptr) @@ -325,9 +321,7 @@ void ZLIB_INTERNAL zcfree (opaque, ptr) voidpf ptr; { (void)opaque; - if (_weaken(free)) { - _weaken(free)(ptr); - } + free(ptr); } #endif /* MY_ZCALLOC */