projects
/
musl
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
fix invalid library phdr pointers passed to callback from dl_iterate_phdr
[musl]
/
src
/
string
/
strerror_r.c
1
#include <string.h>
2
#include <errno.h>
3
#include "libc.h"
4
5
int strerror_r(int err, char *buf, size_t buflen)
6
{
7
char *msg = strerror(err);
8
size_t l = strlen(msg);
9
if (l >= buflen) {
10
if (buflen) {
11
memcpy(buf, msg, buflen-1);
12
buf[buflen-1] = 0;
13
}
14
return ERANGE;
15
}
16
memcpy(buf, msg, l+1);
17
return 0;
18
}
19
20
weak_alias(strerror_r, __xpg_strerror_r);