mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 11:37:35 +00:00
Fix some bugs
- addr2line backtrace should continue on eintr - lua crashes if we try to iterate a non-table
This commit is contained in:
parent
6a145a9262
commit
cc0d1ec076
3 changed files with 22 additions and 10 deletions
|
@ -116,7 +116,17 @@ static int PrintBacktraceUsingAddr2line(int fd, const struct StackFrame *bp) {
|
|||
_exit(127);
|
||||
}
|
||||
close(pipefds[1]);
|
||||
while ((got = read(pipefds[0], buf, kBacktraceBufSize)) > 0) {
|
||||
for (;;) {
|
||||
got = read(pipefds[0], buf, kBacktraceBufSize);
|
||||
if (!got) break;
|
||||
if (got == -1 && errno == EINTR) {
|
||||
errno = 0;
|
||||
continue;
|
||||
}
|
||||
if (got == -1) {
|
||||
kprintf("error reading backtrace %m\n");
|
||||
break;
|
||||
}
|
||||
p1 = buf;
|
||||
p3 = p1 + got;
|
||||
/*
|
||||
|
|
2
third_party/linenoise/linenoise.c
vendored
2
third_party/linenoise/linenoise.c
vendored
|
@ -1834,7 +1834,7 @@ void linenoiseEnd(struct linenoiseState *l) {
|
|||
}
|
||||
|
||||
static int CompareStrings(const void *a, const void *b) {
|
||||
return strcasecmp(*(const char **)a, *(const char **)b);
|
||||
return strcmp(*(const char **)a, *(const char **)b);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
4
third_party/lua/lrepl.c
vendored
4
third_party/lua/lrepl.c
vendored
|
@ -140,6 +140,7 @@ void lua_readline_completions (const char *p, linenoiseCompletions *c) {
|
|||
}
|
||||
|
||||
// search final object
|
||||
if (lua_type(L, -1) == LUA_TTABLE) {
|
||||
lua_pushnil(L);
|
||||
while (lua_next(L, -2)) {
|
||||
if (lua_type(L, -2) == LUA_TSTRING) {
|
||||
|
@ -150,8 +151,9 @@ void lua_readline_completions (const char *p, linenoiseCompletions *c) {
|
|||
}
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
}
|
||||
|
||||
lua_pop(L, 1);
|
||||
lua_pop(L, 1); // pop table
|
||||
|
||||
for (i = 0; i < ARRAYLEN(kKeywordHints); ++i) {
|
||||
if (startswithi(kKeywordHints[i], p)) {
|
||||
|
|
Loading…
Reference in a new issue