aboutsummaryrefslogtreecommitdiff
path: root/src/script/cpp_api/s_security.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/script/cpp_api/s_security.cpp')
-rw-r--r--src/script/cpp_api/s_security.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/script/cpp_api/s_security.cpp b/src/script/cpp_api/s_security.cpp
index 09e971007..3bf8d1044 100644
--- a/src/script/cpp_api/s_security.cpp
+++ b/src/script/cpp_api/s_security.cpp
@@ -457,11 +457,10 @@ bool ScriptApiSecurity::safeLoadFile(lua_State *L, const char *path, const char
size_t start = 0;
int c = std::getc(fp);
if (c == '#') {
- // Skip the first line
- while ((c = std::getc(fp)) != EOF && c != '\n') {}
- if (c == '\n')
- std::getc(fp);
- start = std::ftell(fp);
+ // Skip the shebang line (but keep line-ending)
+ while (c != EOF && c != '\n')
+ c = std::getc(fp);
+ start = std::ftell(fp) - 1;
}
// Read the file