summaryrefslogtreecommitdiff
path: root/payloads/libpayload/libc
diff options
context:
space:
mode:
Diffstat (limited to 'payloads/libpayload/libc')
-rw-r--r--payloads/libpayload/libc/string.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/payloads/libpayload/libc/string.c b/payloads/libpayload/libc/string.c
index 6151164d68..71dd1a6d1b 100644
--- a/payloads/libpayload/libc/string.c
+++ b/payloads/libpayload/libc/string.c
@@ -639,3 +639,17 @@ void perror(const char *s)
{
printf("%s: %d\n", s?s:"(none)", errno);
}
+
+/**
+ * Get a message string describing the given error number.
+ *
+ * @param errnum The error number to be interpreted
+ * @return A pointer to a string describing the given error number
+ */
+char *strerror(int errnum)
+{
+ /* Reserve enough space for the string below + INT64_MIN in decimal + \0 */
+ static char errstr[35];
+ snprintf(errstr, sizeof(errstr), "Unknown error %d", errnum);
+ return errstr;
+}