Skip to content
Snippets Groups Projects
Commit 5cafe12d authored by Avi Kivity's avatar Avi Kivity
Browse files

libc: fix confstr(NULL, ...)

confstr(NULL) is defined to return the size of required storage; use a
temporary string to make it not fault.
parent bb79f038
No related branches found
No related tags found
No related merge requests found
......@@ -414,6 +414,11 @@ long sysconf(int name)
size_t confstr(int name, char* buf, size_t len)
{
char tmp[1];
if (!buf) {
buf = tmp;
len = 1;
}
auto set = [=] (const char* v) { return snprintf(buf, len, "%s", v); };
switch (name) {
case _CS_GNU_LIBC_VERSION: return set("glibc 2.16");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment