summaryrefslogblamecommitdiff
path: root/src/string/strerror_r.c
blob: 6fdd4ce2c844530222a974d3b543a002bec4e04c (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11










                                                 
#include <string.h>
#include <errno.h>

int strerror_r(int err, char *buf, size_t buflen)
{
	char *msg = strerror(err);
	if (strlen(msg) >= buflen)
		return ERANGE;
	strcpy(buf, msg);
	return 0;
}