From 3c17efb0fbc6d26d3a59790ba26fab6756688d41 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 18 Sep 2022 18:42:30 -0400 Subject: Fixed segfault. --- build.sh | 2 +- lpm.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index 004bbc7..706f2ec 100755 --- a/build.sh +++ b/build.sh @@ -37,5 +37,5 @@ xxd -i lpm.lua > lpm.lua.c [[ $OSTYPE != 'msys'* && $CC != *'mingw'* && $CC != "emcc" ]] && LDFLAGS=" $LDFLAGS -ldl -pthread" [[ $OSTYPE == 'msys'* || $CC == *'mingw'* ]] && LDFLAGS="$LDFLAGS -lws2_32 -lz -lwinhttp -lole32 -lcrypt32 -lrpcrt4" -[[ "$@" != *" -g "* || "$@" != *" -O"* ]] && CFLAGS="$CFLAGS -O3" && LDFLAGS="$LDFLAGS -s" +[[ " $@" != *" -g"* && " $@" != *" -O"* ]] && CFLAGS="$CFLAGS -O3" && LDFLAGS="$LDFLAGS -s" $CC $CFLAGS $SRCS $@ -o $BIN $LDFLAGS diff --git a/lpm.c b/lpm.c index 117e616..4a7381f 100644 --- a/lpm.c +++ b/lpm.c @@ -477,7 +477,8 @@ static const luaL_Reg system_lib[] = { { "reset", lpm_reset }, // Updates a git repository to the specified commit/hash/branch. { "status", lpm_status }, // Returns the git repository in question's current branch, if any, and commit hash. { "get", lpm_get }, // HTTP(s) GET request. - { "certs", lpm_certs } // Sets the SSL certificate chain folder/file. + { "certs", lpm_certs }, // Sets the SSL certificate chain folder/file. + { NULL, NULL } }; @@ -514,7 +515,8 @@ int main(int argc, char* argv[]) { git_libgit2_init(); lua_State* L = luaL_newstate(); luaL_openlibs(L); - luaL_newlib(L, system_lib); lua_setglobal(L, "system"); + luaL_newlib(L, system_lib); + lua_setglobal(L, "system"); lua_newtable(L); for (int i = 0; i < argc; ++i) { lua_pushstring(L, argv[i]); -- cgit v1.2.3