diff --git a/src/modules/logger/log_writer_file.cpp b/src/modules/logger/log_writer_file.cpp index 14a2ad01368f..2a3076e3b75c 100644 --- a/src/modules/logger/log_writer_file.cpp +++ b/src/modules/logger/log_writer_file.cpp @@ -92,6 +92,16 @@ bool LogWriterFile::init_logfile_encryption(const char *filename) { if (_algorithm == CRYPTO_NONE) { _min_blocksize = 1; + + // No encryption, just create empty log file + int fd = ::open((const char *)filename, O_CREAT | O_WRONLY | O_DIRECT | O_SYNC, PX4_O_MODE_666); + + if (fd < 0) { + PX4_ERR("Can't open log file, errno: %d", errno); + return false; + } + + ::close(fd); return true; }