[libc] Fix -Wincompatible-library-redeclaration for strerror

Return a char * instead of a const char * to silence this Clang warning.
This commit is contained in:
Alex Richardson
2021-12-09 14:31:38 +00:00
committed by Travis Geiselbrecht
parent 7b12b201fd
commit 7c7612225a
2 changed files with 5 additions and 4 deletions

View File

@@ -22,7 +22,7 @@ char *strcat(char *, char const *);
char *strchr(char const *, int) __PURE;
int strcmp(char const *, char const *) __PURE;
char *strcpy(char *, char const *);
char const *strerror(int) __CONST;
char *strerror(int) __CONST;
size_t strlen(char const *) __PURE;
char *strncat(char *, char const *, size_t);
int strncmp(char const *, char const *, size_t) __PURE;

View File

@@ -9,12 +9,13 @@
#include <string.h>
#include <sys/types.h>
char const *
char *
strerror(int errnum) {
/* The C standard requires a non-const return type for backwards compat. */
if (errnum < 0) {
return "General Error";
return (char *)"General Error";
} else {
return "No Error";
return (char *)"No Error";
}
}