mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-09-24 10:58:09 +08:00
fix(mavlink): identify files in FTP open failure logs (#28627)
Failed FTP opens need the requested path and access mode to identify the file behind the error. Assisted-by: Codex Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
This commit is contained in:
@@ -287,6 +287,12 @@ MavlinkFTP::_process_request(
|
||||
break;
|
||||
}
|
||||
|
||||
if (errorCode == kErrFailErrno && (payload->opcode == kCmdOpenFileRO
|
||||
|| payload->opcode == kCmdCreateFile || payload->opcode == kCmdOpenFileWO)) {
|
||||
PX4_ERR("FTP: open '%s' for %s failed: %s", _data_as_cstring(payload),
|
||||
payload->opcode == kCmdOpenFileRO ? "read" : "write", strerror(_our_errno));
|
||||
}
|
||||
|
||||
out:
|
||||
payload->seq_number++;
|
||||
|
||||
@@ -600,7 +606,6 @@ MavlinkFTP::_workOpen(PayloadHeader *payload, int oflag)
|
||||
|
||||
} else if (!for_write) {
|
||||
_our_errno = errno;
|
||||
PX4_ERR("stat failed read: %s", strerror(_our_errno));
|
||||
return kErrFailErrno;
|
||||
}
|
||||
|
||||
@@ -609,7 +614,6 @@ MavlinkFTP::_workOpen(PayloadHeader *payload, int oflag)
|
||||
|
||||
if (fd < 0) {
|
||||
_our_errno = errno;
|
||||
PX4_ERR("open failed: %s", strerror(_our_errno));
|
||||
return kErrFailErrno;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user