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:
Jacob Dahl
2026-09-08 20:25:55 -06:00
committed by GitHub
parent 7b9b22d080
commit ebc4d50a9e

View File

@@ -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;
}