Skip to content

Commit

Permalink
Fix constructing executable path from argv[0].
Browse files Browse the repository at this point in the history
Do not leave unwanted stuff in the stack in premake_locate_executable(), as the caller only expects exactly one string to be pushed.
  • Loading branch information
lanurmi committed Apr 25, 2018
1 parent 3556135 commit 6fe0b64
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/host/premake.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,7 @@ int premake_locate_executable(lua_State* L, const char* argv0)
lua_concat(L, 3);
path = lua_tostring(L, -1);
}
lua_pop(L, 1);
}

/* If all else fails, use argv[0] as-is and hope for the best */
Expand All @@ -428,6 +429,7 @@ int premake_locate_executable(lua_State* L, const char* argv0)
}

path = lua_tostring(L, -1);
lua_pop(L, 1);
}

lua_pushstring(L, path);
Expand Down

0 comments on commit 6fe0b64

Please sign in to comment.