mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-30 03:40:35 +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:
@@ -32,15 +32,14 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdarg.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <px4_config.h>
|
||||
#include <px4_posix.h>
|
||||
#include "uORBUtils.hpp"
|
||||
#include "uORBManager.hpp"
|
||||
#include "uORBDevices.hpp"
|
||||
#include "px4_config.h"
|
||||
|
||||
|
||||
//========================= Static initializations =================
|
||||
@@ -73,8 +72,7 @@ int uORB::Manager::orb_exists(const struct orb_metadata *meta, int instance)
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
struct stat buffer;
|
||||
return stat(path, &buffer);
|
||||
return px4_access(path, F_OK);
|
||||
}
|
||||
|
||||
orb_advert_t uORB::Manager::orb_advertise(const struct orb_metadata *meta, const void *data)
|
||||
|
||||
Reference in New Issue
Block a user