File execresult.patch of Package lua54

Inspect errno only after failure

---
 src/lauxlib.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: lua-5.4.8/src/lauxlib.c
===================================================================
--- lua-5.4.8.orig/src/lauxlib.c	2025-07-15 22:59:14.411309750 +0200
+++ lua-5.4.8/src/lauxlib.c	2025-07-15 22:59:24.858384379 +0200
@@ -286,7 +286,7 @@
 
 
 LUALIB_API int luaL_execresult (lua_State *L, int stat) {
-  if (stat != 0 && errno != 0)  /* error with an 'errno'? */
+  if (stat == -1)  /* error with an 'errno'? */
     return luaL_fileresult(L, 0, NULL);
   else {
     const char *what = "exit";  /* type of termination */
openSUSE Build Service is sponsored by