mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 07:53:34 +08:00
Created px4_access to handle check of virtual files
uORBManager_posix.cpp did a stat to see if a file exists but the file is actually a virtual file. Using stat was incorrect because it required a stat buffer that was never used. The POSIX access function is a better choice so I created a px4_access version to handle virtual files. Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
@@ -293,6 +293,16 @@ int px4_fsync(int fd)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int px4_access(const char *pathname, int mode)
|
||||
{
|
||||
if (mode == F_OK) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
VDev *dev = VDev::getDev(pathname);
|
||||
return (dev != nullptr) ? 0 : -1;
|
||||
}
|
||||
|
||||
void px4_show_devices()
|
||||
{
|
||||
VDev::showDevices();
|
||||
|
||||
Reference in New Issue
Block a user