Skip to contentSkip to conversation

lua: change grub.file_seek() to return error code, not the old offset

PATCH New Pavel Roskin 1 participant 1 message Jul 23, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lua: change grub.file_seek() to return error code, not the old offset

This makes it easier to check if the call has succeeded. The old offset is rarely needed.

ChangeLog:

* script/lua/grub_lib.c (grub_lua_file_seek): Return error code, not the old offset.

---
 script/lua/grub_lib.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
script/lua/grub_lib.c +2 -5
index d26f193..42f370a 100644
@@ -266,12 +266,9 @@ grub_lua_file_seek (lua_State *state)
   luaL_checktype (state, 1, LUA_TLIGHTUSERDATA);
   file = lua_touserdata (state, 1);
   offset = luaL_checkinteger (state, 2);
+  grub_file_seek (file, offset);
 
-  offset = grub_file_seek (file, offset);
-  save_errno (state);
-
-  lua_pushinteger (state, offset);
-  return 1;
+  return push_result (state);
 }
 
 static int