Added FileNotFound error code according to new Mavlink FTP specification

This commit is contained in:
Matej Frančeškin 2019-09-17 15:21:18 +02:00 committed by Lorenz Meier
parent 116de6d25f
commit ef865a091f
2 changed files with 6 additions and 5 deletions

View File

@ -269,6 +269,8 @@ out:
if (r_errno == EEXIST) {
errorCode = kErrFailFileExists;
} else if (r_errno == ENOENT) {
errorCode = kErrFileNotFound;
}
payload->data[0] = errorCode;
@ -350,9 +352,7 @@ MavlinkFTP::_workList(PayloadHeader *payload, bool list_hidden)
if (dp == nullptr) {
PX4_WARN("File open failed %s", _work_buffer1);
// this is not an FTP error, abort directory by setting errno to ENOENT "No such file or directory"
errno = ENOENT;
return kErrFailErrno;
return kErrFileNotFound;
}
#ifdef MAVLINK_FTP_DEBUG

View File

@ -119,8 +119,9 @@ public:
kErrNoSessionsAvailable, ///< All available Sessions in use
kErrEOF, ///< Offset past end of file for List and Read commands
kErrUnknownCommand, ///< Unknown command opcode
kErrFailFileExists, ///< File exists already
kErrFailFileProtected ///< File is write protected
kErrFailFileExists, ///< File/directory exists already
kErrFailFileProtected, ///< File/directory is write protected
kErrFileNotFound ///< File/directory not found
};
unsigned get_size();