diff options
author | Stefan Tauner <stefan.tauner@gmx.at> | 2013-06-27 17:06:27 +0200 |
---|---|---|
committer | Nico Huber <nico.huber@secunet.com> | 2013-06-28 10:39:57 +0200 |
commit | c9246da4ddff9fef2bb26d05d87d1f616124b91e (patch) | |
tree | 305c9635113740451c08bc5572ce1bece8b027f2 /payloads/libpayload/libc/string.c | |
parent | c0b1a48cdaed0a9c955fd98563a1d5906a72b533 (diff) | |
download | coreboot-c9246da4ddff9fef2bb26d05d87d1f616124b91e.tar.xz |
libpayload: Add strerror
Change-Id: I33d45ad7d09473b8c6f5b7ee5fbadc0d184f9dcd
Signed-off-by: Stefan Tauner <stefan.tauner@gmx.at>
Reviewed-on: http://review.coreboot.org/3537
Tested-by: build bot (Jenkins)
Reviewed-by: Nico Huber <nico.huber@secunet.com>
Diffstat (limited to 'payloads/libpayload/libc/string.c')
-rw-r--r-- | payloads/libpayload/libc/string.c | 14 |
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; +} |