repo.or.cz
/
musl.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
select: overhaul for time64
[musl.git]
/
src
/
string
/
strerror_r.c
blob
1dc88bb160372b6d7c9a95fbc68ccd9bdef89d47
1
#include <string.h>
2
#include <errno.h>
3
4
int
strerror_r
(
int
err
,
char
*
buf
,
size_t
buflen
)
5
{
6
char
*
msg
=
strerror
(
err
);
7
size_t
l
=
strlen
(
msg
);
8
if
(
l
>=
buflen
) {
9
if
(
buflen
) {
10
memcpy
(
buf
,
msg
,
buflen
-
1
);
11
buf
[
buflen
-
1
] =
0
;
12
}
13
return
ERANGE
;
14
}
15
memcpy
(
buf
,
msg
,
l
+
1
);
16
return
0
;
17
}
18
19
weak_alias
(
strerror_r
,
__xpg_strerror_r
);