Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Adélie Linux
gcompat
Commits
af5a49e4
Verified
Commit
af5a49e4
authored
Dec 14, 2020
by
A. Wilcox
🦊
Browse files
string: Add wrong strerror_r
parent
11a020c3
Changes
2
Hide whitespace changes
Inline
Side-by-side
CHANGELOG.rst
View file @
af5a49e4
...
...
@@ -8,6 +8,20 @@
© 2016-2020 Adélie Software and contributors. NCSA open source license.
1.1 (202?-??-??)
================
locale
------
* Redesign newlocale, courtesy of rcombs.
string
------
* Add historical, non-POSIX strerror_r definition.
1.0.0 (2020-09-27)
==================
...
...
libgcompat/string.c
View file @
af5a49e4
#define _GNU_SOURCE
/* mempcpy */
#include <assert.h>
/* assert */
#include <dlfcn.h>
/* dlsym, RTLD_NEXT */
#include <stddef.h>
/* NULL, size_t */
#include <stdint.h>
/* SIZE_MAX */
#include <stdlib.h>
/* rand_r */
#define strerror_r no_strerror_r
#include <string.h>
/* memcpy, strcpy, strncat, strndup */
#undef strerror_r
#include <time.h>
/* time */
#include <unistd.h>
/* getpid */
...
...
@@ -210,6 +213,21 @@ char *__strdup(const char *string)
return
strdup
(
string
);
}
/**
* Non-POSIX strerror_r.
*/
static
int
(
*
real_strerror_r
)(
int
,
char
*
,
size_t
);
char
*
strerror_r
(
int
errnum
,
char
*
buf
,
size_t
buflen
)
{
if
(
real_strerror_r
==
NULL
)
{
real_strerror_r
=
dlsym
(
RTLD_NEXT
,
"strerror_r"
);
assert
(
real_strerror_r
);
}
real_strerror_r
(
errnum
,
buf
,
buflen
);
return
buf
;
}
/**
* Concatenate a string with part of another, with buffer overflow checking.
*
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment