2022-01-01 10:54:23 -08:00
|
|
|
/* Copyright (C) 1991-2022 Free Software Foundation, Inc.
|
2005-12-14 08:43:25 +00:00
|
|
|
This file is part of the GNU C Library.
|
|
|
|
|
|
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
Lesser General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2012-02-09 23:18:22 +00:00
|
|
|
License along with the GNU C Library; if not, see
|
2019-09-06 22:40:42 -07:00
|
|
|
<https://www.gnu.org/licenses/>. */
|
2005-12-14 08:43:25 +00:00
|
|
|
|
2020-05-14 18:14:43 -03:00
|
|
|
#include <string.h>
|
2005-12-14 08:43:25 +00:00
|
|
|
#include <libintl.h>
|
|
|
|
|
#include <stdio.h>
|
2011-05-21 12:09:23 -04:00
|
|
|
#include <stdlib.h>
|
2005-12-14 08:43:25 +00:00
|
|
|
|
|
|
|
|
/* Return a string describing the errno code in ERRNUM. */
|
|
|
|
|
char *
|
|
|
|
|
__strerror_r (int errnum, char *buf, size_t buflen)
|
|
|
|
|
{
|
2020-04-24 21:25:31 -03:00
|
|
|
char *err = (char *) __get_errlist (errnum);
|
|
|
|
|
if (__glibc_unlikely (err == NULL))
|
2005-12-14 08:43:25 +00:00
|
|
|
{
|
2020-05-14 18:14:43 -03:00
|
|
|
__snprintf (buf, buflen, "%s%d", _("Unknown error "), errnum);
|
2005-12-14 08:43:25 +00:00
|
|
|
return buf;
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-24 21:25:31 -03:00
|
|
|
return _(err);
|
2005-12-14 08:43:25 +00:00
|
|
|
}
|
|
|
|
|
weak_alias (__strerror_r, strerror_r)
|
|
|
|
|
libc_hidden_def (__strerror_r)
|