FFI: Allow setting errno with ffi.errno(), too.

This commit is contained in:
Mike Pall
2011-05-09 11:51:19 +02:00
parent 868ecad32b
commit d9c1f771a7
2 changed files with 10 additions and 5 deletions

View File

@@ -545,7 +545,10 @@ LJLIB_CF(ffi_offsetof)
LJLIB_CF(ffi_errno)
{
setintV(L->top++, errno);
int err = errno;
if (L->top > L->base)
errno = ffi_checkint(L, 1);
setintV(L->top++, err);
return 1;
}