@@ -32,6 +32,9 @@ expected<iox_stat, FileStatError> get_file_status(const int fildes) noexcept
3232 {
3333 switch (result.error ().errnum )
3434 {
35+ case EBADF:
36+ IOX_LOG (ERROR, " The provided file descriptor is invalid." );
37+ return err (FileStatError::BadFileDescriptor);
3538 case EIO:
3639 IOX_LOG (ERROR, " Unable to acquire file status since an io failure occurred while reading." );
3740 return err (FileStatError::IoFailure);
@@ -41,7 +44,7 @@ expected<iox_stat, FileStatError> get_file_status(const int fildes) noexcept
4144 " corresponding structure." );
4245 return err (FileStatError::FileTooLarge);
4346 default :
44- IOX_LOG (ERROR, " Unable to acquire file status due to an unknown failure" );
47+ IOX_LOG (ERROR, " Unable to acquire file status due to an unknown failure. errno: " << result. error (). errnum );
4548 return err (FileStatError::UnknownError);
4649 }
4750 }
@@ -57,6 +60,9 @@ expected<void, FileSetOwnerError> set_owner(const int fildes, const uid_t uid, c
5760 {
5861 switch (result.error ().errnum )
5962 {
63+ case EBADF:
64+ IOX_LOG (ERROR, " The provided file descriptor is invalid." );
65+ return err (FileSetOwnerError::BadFileDescriptor);
6066 case EPERM:
6167 IOX_LOG (ERROR, " Unable to set owner due to insufficient permissions." );
6268 return err (FileSetOwnerError::PermissionDenied);
@@ -75,7 +81,7 @@ expected<void, FileSetOwnerError> set_owner(const int fildes, const uid_t uid, c
7581 IOX_LOG (ERROR, " Unable to set owner since an interrupt was received." );
7682 return err (FileSetOwnerError::Interrupt);
7783 default :
78- IOX_LOG (ERROR, " Unable to set owner since an unknown error occurred." );
84+ IOX_LOG (ERROR, " Unable to set owner since an unknown error occurred. errno: " << result. error (). errnum );
7985 return err (FileSetOwnerError::UnknownError);
8086 }
8187 }
@@ -91,14 +97,18 @@ expected<void, FileSetPermissionError> set_permissions(const int fildes, const a
9197 {
9298 switch (result.error ().errnum )
9399 {
100+ case EBADF:
101+ IOX_LOG (ERROR, " The provided file descriptor is invalid." );
102+ return err (FileSetPermissionError::BadFileDescriptor);
94103 case EPERM:
95104 IOX_LOG (ERROR, " Unable to adjust permissions due to insufficient permissions." );
96105 return err (FileSetPermissionError::PermissionDenied);
97106 case EROFS:
98107 IOX_LOG (ERROR, " Unable to adjust permissions since it is a read-only filesystem." );
99108 return err (FileSetPermissionError::ReadOnlyFilesystem);
100109 default :
101- IOX_LOG (ERROR, " Unable to adjust permissions since an unknown error occurred." );
110+ IOX_LOG (ERROR,
111+ " Unable to adjust permissions since an unknown error occurred. errno: " << result.error ().errnum );
102112 return err (FileSetPermissionError::UnknownError);
103113 }
104114 }
0 commit comments