lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

> I just noticed, lua-5.1-rc has the same problems with errno: between
> the syscall setting errno and the usage of errno there are several
> function calls that may destroy its value (i.e. lua_push* may call
> lockmutex, malloc, generate fp-errors, etc).  And ferror doesn't set
> errno at all.

* lockmutex: users use this facility at their own risk...

* malloc: as far as I know, a correct malloc should not change errno.
An error in malloc generates a MEMERR, so errno is not used.

* I think only lua_pushinteger may generate fp-errors. We do not call
it before using errno. (Well, ok, a pushstring may even call a gc
tag method...)

* "And ferror doesn't set errno at all." What is the point here?

We will try to improve that.

-- Roberto