From ba6d0e1ad9b12127a81a60514963b8c0919ea9b2 Mon Sep 17 00:00:00 2001 From: NiteHawk Date: Fri, 25 Mar 2016 12:13:09 +0100 Subject: Have make_link() use pushresult() instead of pusherror() on Windows The pushresult(L, -1, ...) call will delegate to pusherror() anyway, but this avoids the "Unused static" warning for pushresult. Also take care of assigning something meaningful to `errno`, as strerror(errno) is used for constructing the Lua error message. Fixes #65 --- src/lfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lfs.c b/src/lfs.c index 8b4cfd2..866740f 100644 --- a/src/lfs.c +++ b/src/lfs.c @@ -431,7 +431,8 @@ static int make_link(lua_State *L) return pushresult(L, (lua_toboolean(L,3) ? symlink : link)(oldpath, newpath), NULL); #else - return pusherror(L, "make_link is not supported on Windows"); + errno = ENOSYS; /* = "Function not implemented" */ + return pushresult(L, -1, "make_link is not supported on Windows"); #endif } -- cgit v1.2.3-55-g6feb