mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-04-20 13:54:42 +00:00
Only re-open executable as O_RDWR if .ape present (#234)
AWS Lambda uses a nonstandard kernel behavior that causes OpenExecutable() to SIGSEGV after redbean restores its APE header. This change fixes a bug so that Lambda users may work around the issue by removing the `.ape` file inside the zip structure of redbean.com. Fixes #233
This commit is contained in:
parent
28a592f2d4
commit
75fc601ff5
1 changed files with 2 additions and 3 deletions
|
@ -5035,7 +5035,6 @@ static int LuaGetComment(lua_State *L) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int LuaGetHostOs(lua_State *L) {
|
static int LuaGetHostOs(lua_State *L) {
|
||||||
const char *s = NULL;
|
const char *s = NULL;
|
||||||
if (IsLinux()) {
|
if (IsLinux()) {
|
||||||
|
@ -6472,9 +6471,9 @@ static void RestoreApe(void) {
|
||||||
if (IsOpenbsd()) return; /* TODO */
|
if (IsOpenbsd()) return; /* TODO */
|
||||||
if (IsNetbsd()) return; /* TODO */
|
if (IsNetbsd()) return; /* TODO */
|
||||||
if (endswith(zpath, ".com.dbg")) return;
|
if (endswith(zpath, ".com.dbg")) return;
|
||||||
|
if ((a = GetAssetZip("/.ape", 5)) && (p = LoadAsset(a, &n))) {
|
||||||
close(zfd);
|
close(zfd);
|
||||||
zfd = OpenExecutable();
|
zfd = OpenExecutable();
|
||||||
if ((a = GetAssetZip("/.ape", 5)) && (p = LoadAsset(a, &n))) {
|
|
||||||
write(zfd, p, n);
|
write(zfd, p, n);
|
||||||
free(p);
|
free(p);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue