mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
DataFlash: don't try to create a directory that exists
this is an attempt to avoid microSD card corruption. The most common corruption is two 'logs' directories, which may indicate an issue with trying to create it a 2nd time.
This commit is contained in:
parent
5767aa47d9
commit
4ce2555a65
@ -50,8 +50,12 @@ void DataFlash_File::Init(void)
|
||||
{
|
||||
// create the log directory if need be
|
||||
int ret;
|
||||
ret = mkdir(_log_directory, 0777);
|
||||
if (ret == -1 && errno != EEXIST) {
|
||||
struct stat st;
|
||||
ret = stat(_log_directory, &st);
|
||||
if (ret == -1) {
|
||||
ret = mkdir(_log_directory, 0777);
|
||||
}
|
||||
if (ret == -1) {
|
||||
hal.console->printf("Failed to create log directory %s", _log_directory);
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user