Added ERANGE error.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@15249 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
Giovanni Di Sirio 2021-12-24 10:44:55 +00:00
parent 8e60050444
commit ef0117ed3d
2 changed files with 5 additions and 4 deletions

View File

@ -58,6 +58,7 @@
#define VFS_RET_ENOSPC (-32 - ENOSPC) /* No space left on device */ #define VFS_RET_ENOSPC (-32 - ENOSPC) /* No space left on device */
#define VFS_RET_ESPIPE (-32 - ESPIPE) /* Illegal seek */ #define VFS_RET_ESPIPE (-32 - ESPIPE) /* Illegal seek */
#define VFS_RET_EROFS (-32 - EROFS) /* Read-only file system */ #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 */ #define VFS_RET_ENAMETOOLONG (-32 - ENAMETOOLONG)/* File or path name too long */
/** @} */ /** @} */

View File

@ -58,7 +58,7 @@
* @param[in] src The source path. * @param[in] src The source path.
* @param[in[ size Destination buffer size. * @param[in[ size Destination buffer size.
* @return The operation status. * @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) { msg_t vfs_path_append(char *dst, const char *src, size_t size) {
size_t n; size_t n;
@ -66,7 +66,7 @@ msg_t vfs_path_append(char *dst, const char *src, size_t size) {
/* Current path length.*/ /* Current path length.*/
n = strnlen(dst, size); n = strnlen(dst, size);
if (n >= size) { if (n >= size) {
return VFS_RET_ENAMETOOLONG; return VFS_RET_ERANGE;
} }
/* Making sure to start with a separator in place.*/ /* 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++; n++;
if (n > size) { 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] src The source path.
* @param[in[ size Destination buffer size. * @param[in[ size Destination buffer size.
* @return The operation status. * @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) { msg_t vfs_path_normalize(char *dst, const char *src, size_t size) {
size_t n; size_t n;