Make fixes and improvements

- Polyfill UTIME_OMIT on XNU
- Refactor Lua build code so it's better
- Add unix module to lua.com (Discord request)
- Add unix.utimensat() and unix.futimens() to redbean
- Avoid creating double slash path in linenoise (#428)
- Remove double slashes in NT paths automatically (#428)
- Make strerror() smarter about showing NT errors (#428)

Fixes #428
This commit is contained in:
Justine Tunney 2022-06-18 01:10:29 -07:00
parent 67b28b9af1
commit c1cfca8ae1
18 changed files with 569 additions and 194 deletions

View file

@ -23,6 +23,7 @@
#include "libc/dce.h"
#include "libc/sysv/consts/at.h"
#include "libc/sysv/consts/o.h"
#include "libc/sysv/consts/utime.h"
#include "libc/testlib/testlib.h"
#include "libc/time/time.h"
@ -59,3 +60,20 @@ TEST(futimens, test) {
EXPECT_EQ(1655455857, st.st_atim.tv_sec);
EXPECT_EQ(827727928, st.st_mtim.tv_sec);
}
TEST(utimensat, testOmit) {
if (IsLinux() && !__is_linux_2_6_23()) {
// TODO(jart): Ugh.
return;
}
struct stat st;
struct timespec ts[2] = {
{123, UTIME_OMIT},
{123, UTIME_OMIT},
};
EXPECT_SYS(0, 0, touch("boop", 0644));
EXPECT_SYS(0, 0, utimensat(AT_FDCWD, "boop", ts, 0));
EXPECT_SYS(0, 0, stat("boop", &st));
EXPECT_NE(123, st.st_atim.tv_sec);
EXPECT_NE(123, st.st_mtim.tv_sec);
}