Signed-off-by: liqiao49 <liqiao49@huawei.com>
This commit is contained in:
liqiao49
2023-07-26 19:41:20 +08:00
parent 4aa92af7ad
commit 22e363ebbd
2 changed files with 5 additions and 8 deletions
+2 -3
View File
@@ -327,9 +327,8 @@ void StringSplitToVector(const std::string& str, const char split, std::vector<s
int OpenInputDeviceFdByPath(std::string devicePath)
{
chmod(devicePath.c_str(), S_IWRITE | S_IREAD);
char canonicalDevicePath[PATH_MAX + 1] = {0x00};
canonicalDevicePath[PATH_MAX] = '\0';
if (devicePath.length() == 0 || devicePath.length() >= PATH_MAX ||
char* canonicalDevicePath = new char(PATH_MAX);
if (devicePath.length() == 0 || devicePath.length() > PATH_MAX ||
realpath(devicePath.c_str(), canonicalDevicePath) == nullptr) {
DHLOGE("path check fail, error path: %s", devicePath.c_str());
return -1;