From 70c372329ce1e6105d7ed329612a09a1c3917c25 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Wed, 23 Dec 2020 09:28:44 +0100 Subject: [PATCH] MAVLink FTP: Update implementation according to updates specs The MAVLink specs for CreateFile in MAVLink FTP were updated on Dec 23, 2020 (today) with a behavior change to truncate a file if it already existed, following the UNIX standard behavior: https://pubs.opengroup.org/onlinepubs/9699919799/functions/creat.html. This change is tracking that spec change. While it is a functional change, the limited usage of the FTP protocol and the fact that implementations should not rely on error states to determine wether to truncate a file or not makes this a viable change. --- src/modules/mavlink/mavlink_ftp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/mavlink/mavlink_ftp.cpp b/src/modules/mavlink/mavlink_ftp.cpp index f556cff911..574ec21596 100644 --- a/src/modules/mavlink/mavlink_ftp.cpp +++ b/src/modules/mavlink/mavlink_ftp.cpp @@ -215,7 +215,7 @@ MavlinkFTP::_process_request( break; case kCmdCreateFile: - errorCode = _workOpen(payload, O_CREAT | O_EXCL | O_WRONLY); + errorCode = _workOpen(payload, O_CREAT | O_TRUNC | O_WRONLY); break; case kCmdOpenFileWO: