Comments (3)
Looks like https://github.com/keplerproject/lua-compat-5.3/blob/9cb6834fe07297ba79e7453978cf7e7d8d8c339a/c-api/compat-5.3.c#L36 should be change to just !defined(_GNU_SOURCE)
from lua-compat-5.3.
First, it should be !defined(_GNU_SOURCE)
. At least that's what the official headers use apparently (even though the manpage claims (_POSIX_C_SOURCE >= 200112L) && ! _GNU_SOURCE
), probably to avoid this exact issue.
Second, we have another problem: It seems that we don't have a reliable way to detect whether we have the GNU version or the POSIX version of strerror_r
. Checking the same preprocessor symbols might not do it, because those can change between inclusion of string.h
and our tests.
At the moment I'm considering something like the following when a glibc is used:
char buffer[255] = { 0 }; /* zero initialized */
int myerrno = errno;
strerror_r(myerrno, buffer, sizeof(buffer)); /* use either version of strerror_r */
if (buffer[0] != '\0')
return buffer; /* strerror_r wrote into our buffer */
else
/* buffer is unchanged, so we probably have GNU strerror_r which returned a
* static constant string. Chances are that strerror will return the same static
* constant string and therefore be thread-safe. */
return strerror(myerrno);
When I find time I'll take a look at the glibc sources to make sure that the last assumption at least holds for the current glibc version.
I'm open to other suggestions.
from lua-compat-5.3.
from lua-compat-5.3.
Related Issues (20)
- Failure with luajit 2.1 HOT 4
- Compiling with Lua 5.3 fails HOT 1
- lua_pushstring should return pushed string
- Macro safety HOT 1
- Add lua_resume
- luaL_Stream
- LUAERRGCM missing HOT 1
- luaL_loadbufferx HOT 1
- lua_getuservalue should return type HOT 2
- lua_tointegerx accepts non-integers HOT 5
- Build fail with x86_64-w64-mingw32-gcc on MacOS HOT 1
- luaossl installation fails on alpine docker image HOT 8
- src/compat-5.3.c:59:9: error: implicit declaration of function 'strerror_r' [-Werror=implicit-function-declaration]
- src/compat-5.3.c:451:42: error: initializer element is not computable at load time [-Werror=pedantic] HOT 2
- luaL_typeerror HOT 4
- How to compile on windows HOT 4
- Lua 5.4 HOT 11
- Tests fail on 32bit systems HOT 18
- table.maxn HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lua-compat-5.3.