From e1e86ab889615e742feb89705cc3c7346ab3ac7f Mon Sep 17 00:00:00 2001 From: apio Date: Sun, 16 Oct 2022 17:24:58 +0200 Subject: [PATCH] libc: Add support for EEXIST, ENOTDIR, ENOSPC, ENOTSUP and EPIPE to strerror() --- libs/libc/include/errno.h | 2 +- libs/libc/src/string.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libs/libc/include/errno.h b/libs/libc/include/errno.h index d0f0a9fa..b1496ee6 100644 --- a/libs/libc/include/errno.h +++ b/libs/libc/include/errno.h @@ -11,7 +11,7 @@ extern int errno; #define ENOMEM 12 // Cannot allocate memory #define EFAULT 14 // Bad address #define EEXIST 17 // File exists -#define ENOTDIR 10 // Not a directory +#define ENOTDIR 20 // Not a directory #define EISDIR 21 // Is a directory #define EINVAL 22 // Invalid argument #define EMFILE 24 // Too many open files diff --git a/libs/libc/src/string.cpp b/libs/libc/src/string.cpp index 683168ff..df1a8f4d 100644 --- a/libs/libc/src/string.cpp +++ b/libs/libc/src/string.cpp @@ -201,6 +201,11 @@ extern "C" case EISDIR: return "Is a directory"; case ENOEXEC: return "Exec format error"; case EFAULT: return "Bad address"; + case EEXIST: return "File exists"; + case ENOTDIR: return "Not a directory"; + case ENOSPC: return "No space left on device"; + case ENOTSUP: return "Operation not supported"; + case EPIPE: return "Broken pipe"; case 0: return "Success"; default: return "Unknown error"; }