mirror of https://github.com/ArduPilot/ardupilot
AP_Filesystem: fixed open to return nullptr on failure
this impacts lua io.open()
This commit is contained in:
parent
7942b58fba
commit
5fc018fff4
|
@ -83,6 +83,10 @@ APFS_FILE *apfs_fopen(const char *pathname, const char *mode)
|
|||
return nullptr;
|
||||
}
|
||||
f->fd = AP::FS().open(pathname, posix_fopen_modes_to_open(mode));
|
||||
if (f->fd == -1) {
|
||||
delete f;
|
||||
return nullptr;
|
||||
}
|
||||
f->unget = -1;
|
||||
return f;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue