Skip to content

Commit

Permalink
Fix #867, better error translation for ESPIPE errno
Browse files Browse the repository at this point in the history
The ESPIPE errno means that seeking is not supported on the
given file handle.  Translate to the OS_ERR_OPERATION_NOT_SUPPORTED
error rather than not implemented as it better indicates the
actual condition.
  • Loading branch information
jphickey committed Mar 12, 2021
1 parent ead5723 commit 7853845
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/os/portable/os-impl-posix-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ int32 OS_GenericSeek_Impl(const OS_object_token_t *token, int32 offset, uint32 w
* Use a different error code to differentiate from an
* error involving a bad whence/offset
*/
retval = OS_ERR_NOT_IMPLEMENTED;
retval = OS_ERR_OPERATION_NOT_SUPPORTED;
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void Test_OS_GenericSeek_Impl(void)

/* The seek implementation also checks for this specific pipe errno */
OCS_errno = OCS_ESPIPE;
OSAPI_TEST_FUNCTION_RC(OS_GenericSeek_Impl, (&token, 0, OS_SEEK_END), OS_ERR_NOT_IMPLEMENTED);
OSAPI_TEST_FUNCTION_RC(OS_GenericSeek_Impl, (&token, 0, OS_SEEK_END), OS_ERR_OPERATION_NOT_SUPPORTED);
}

void Test_OS_GenericRead_Impl(void)
Expand Down

0 comments on commit 7853845

Please sign in to comment.