DataFlash_File: check fname before using it

This commit is contained in:
Peter Barker 2015-12-08 23:07:43 +11:00 committed by Andrew Tridgell
parent 74902012fd
commit 15265a45ed
1 changed files with 3 additions and 0 deletions

View File

@ -775,6 +775,9 @@ uint16_t DataFlash_File::start_new_log(void)
log_num = 1;
}
char *fname = _log_file_name(log_num);
if (fname == NULL) {
return 0xFFFF;
}
_write_fd = ::open(fname, O_WRONLY|O_CREAT|O_TRUNC, 0666);
_cached_oldest_log = 0;