Write more redbean unit tests

- Fix DescribeSigset()
- Introduce new unix.rmrf() API
- Fix redbean sigaction() doc example code
- Fix unix.sigaction() w/ more than two args
- Improve redbean re module API (non-breaking)
- Enhance Lua with Python string multiplication
- Make third parameter of unix.socket() default to 0
This commit is contained in:
Justine Tunney 2022-07-08 23:06:46 -07:00
parent c5b9902ac9
commit 1c83670229
20 changed files with 738 additions and 204 deletions

View file

@ -21,15 +21,15 @@
#include "libc/intrin/describeflags.internal.h"
#include "libc/intrin/kprintf.h"
const char *(DescribeSigaction)(char buf[128], int rc,
const char *(DescribeSigaction)(char buf[256], int rc,
const struct sigaction *sa) {
if (rc == -1) return "n/a";
if (!sa) return "NULL";
if ((!IsAsan() && kisdangerous(sa)) ||
(IsAsan() && !__asan_is_valid(sa, sizeof(*sa)))) {
ksnprintf(buf, 128, "%p", sa);
ksnprintf(buf, 256, "%p", sa);
} else {
ksnprintf(buf, 128, "{.sa_handler=%p, .sa_flags=%#lx, .sa_mask=%s}",
ksnprintf(buf, 256, "{.sa_handler=%t, .sa_flags=%#lx, .sa_mask=%s}",
sa->sa_handler, sa->sa_flags, DescribeSigset(rc, &sa->sa_mask));
}
return buf;