mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-11-25 00:30:50 +08:00
fix(logger): Fix log_writer_file compilation on some platforms (#28230)
Fix the two issues: - HARDFAULT_ULOG_PATH is not necessarily defined for all the targets which have px4_savepanic defined. Check it separately. - %d formatter only works for size_t /ssize_t for 32-bit targets. Use %zu / % zd instead, which should work for all. Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
This commit is contained in:
1 parent
0c38054510
commit
6f41d858b9
1 file changed
+2
-2
@@ -243,7 +243,7 @@ bool LogWriterFile::start_log(LogType type, const char *filename)
|
||||
|
||||
int LogWriterFile::hardfault_store_filename(const char *log_file)
|
||||
{
|
||||
#if defined(__PX4_NUTTX) && defined(px4_savepanic)
|
||||
#if defined(__PX4_NUTTX) && defined(px4_savepanic) && defined(HARDFAULT_ULOG_PATH)
|
||||
int fd = open(HARDFAULT_ULOG_PATH, O_TRUNC | O_WRONLY | O_CREAT);
|
||||
|
||||
if (fd < 0) {
|
||||
@@ -662,7 +662,7 @@ bool LogWriterFile::LogFileBuffer::start_log(const char *filename)
|
||||
(ssize_t)_buffer_size_min);
|
||||
|
||||
if ((reduced_buffer_size > 0) && ((ssize_t)_buffer_size > reduced_buffer_size)) {
|
||||
PX4_WARN("requested buffer size %dB limited to available %dB (available plus 1 kB margin)",
|
||||
PX4_WARN("requested buffer size %zuB limited to available %zdB (available plus 1 kB margin)",
|
||||
_buffer_size, reduced_buffer_size);
|
||||
|
||||
_buffer_size = reduced_buffer_size;
|
||||
|
||||
Reference in new issue
Block a user