Compare commits

...

2 Commits

Author SHA1 Message Date
dan cafb33d5f0 die 2026-05-19 21:21:56 +01:00
dan eaede95bac check malloc failure 2026-05-19 21:21:45 +01:00
+4 -2
View File
@@ -90,8 +90,7 @@ int start_lua_child(lua_State *L,
lua_setglobal(L, "arg");
int status = luaL_dofile(L, pathname);
if (status) {
fprintf(stderr, "Error: %s\n", lua_tostring(L, -1));
return 1;
die("Lua error: %s", lua_tostring(L, -1));
} else {
return 0;
}
@@ -216,6 +215,9 @@ int main(int argc, char **argv)
int len = recvmsg(socket, &msg , 0);
int *peer_fds = fds_from_msg(&msg, 5);
char *argline = malloc(len);
if(! argline) {
die("malloc failed");
}
memmove(argline, buf, len);
pid_t child_pid = fork_lua(L, argline, len, peer_fds, 5);