From ef0117ed3d99804b270559b1a40a76282bed9eb4 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Fri, 24 Dec 2021 10:44:55 +0000 Subject: [PATCH] Added ERANGE error. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@15249 27425a3e-05d8-49a3-a47f-9c15f0e5edd8 --- os/vfs/include/vfserrors.h | 1 + os/vfs/src/vfspaths.c | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/os/vfs/include/vfserrors.h b/os/vfs/include/vfserrors.h index 8380313da..7dbe75cc2 100644 --- a/os/vfs/include/vfserrors.h +++ b/os/vfs/include/vfserrors.h @@ -58,6 +58,7 @@ #define VFS_RET_ENOSPC (-32 - ENOSPC) /* No space left on device */ #define VFS_RET_ESPIPE (-32 - ESPIPE) /* Illegal seek */ #define VFS_RET_EROFS (-32 - EROFS) /* Read-only file system */ +#define VFS_RET_ERANGE (-32 - ERANGE) /* Result too large */ #define VFS_RET_ENAMETOOLONG (-32 - ENAMETOOLONG)/* File or path name too long */ /** @} */ diff --git a/os/vfs/src/vfspaths.c b/os/vfs/src/vfspaths.c index 532fb76c8..3009a9b32 100644 --- a/os/vfs/src/vfspaths.c +++ b/os/vfs/src/vfspaths.c @@ -58,7 +58,7 @@ * @param[in] src The source path. * @param[in[ size Destination buffer size. * @return The operation status. - * @retval VFS_RET_ENAMETOOLONG If the path size exceeded the buffer size. + * @retval VFS_RET_ERANGE If the path size exceeded the buffer size. */ msg_t vfs_path_append(char *dst, const char *src, size_t size) { size_t n; @@ -66,7 +66,7 @@ msg_t vfs_path_append(char *dst, const char *src, size_t size) { /* Current path length.*/ n = strnlen(dst, size); if (n >= size) { - return VFS_RET_ENAMETOOLONG; + return VFS_RET_ERANGE; } /* Making sure to start with a separator in place.*/ @@ -92,7 +92,7 @@ msg_t vfs_path_append(char *dst, const char *src, size_t size) { n++; if (n > size) { - return VFS_RET_ENAMETOOLONG; + return VFS_RET_ERANGE; } } @@ -108,7 +108,7 @@ msg_t vfs_path_append(char *dst, const char *src, size_t size) { * @param[in] src The source path. * @param[in[ size Destination buffer size. * @return The operation status. - * @retval VFS_RET_ENAMETOOLONG If the path size exceeded the buffer size. + * @retval VFS_RET_ERANGE If the path size exceeded the buffer size. */ msg_t vfs_path_normalize(char *dst, const char *src, size_t size) { size_t n;