[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Luajit and errno
- From: Mike Pall <mikelu-1105@...>
- Date: Mon, 9 May 2011 11:54:04 +0200
Florian Weimer wrote:
> Could you add ffi.seterrno(), too? I think it's needed because there
> are some C functions that cannot signal all errors if the original
> errno value is non-zero (e.g. strtold()).
I don't think there's a problem for strtol(), but the man page for
errno mentions getpriority().
I've extended ffi.errno() to take an optional argument. See:
http://luajit.org/ext_ffi_api.html#ffi_errno
Note that clearing errno before a C function call and then
checking for a non-zero errno should only be used for these
exceptional cases. For most C functions the return value gives a
clear indication whether errno was set or not. Checking the return
value first is faster, too.
--Mike