mirror of
https://github.com/openharmony/distributedhardware_distributed_input.git
synced 2026-07-19 17:43:35 -04:00
@@ -168,7 +168,7 @@ void DInputState::CheckKeyboardState(std::string &dhid, std::string &keyboardNod
|
||||
{
|
||||
DHLOGI("CheckKeyboardState enter, dhid %s, keyboardNodePath %s.", GetAnonyString(dhid).c_str(),
|
||||
keyboardNodePath.c_str());
|
||||
char* canonicalPath = new char(PATH_MAX);
|
||||
char canonicalPath[PATH_MAX] = {0x00};
|
||||
if (keyboardNodePath.length() == 0 || keyboardNodePath.length() >= PATH_MAX ||
|
||||
realpath(keyboardNodePath.c_str(), canonicalPath) == nullptr) {
|
||||
DHLOGE("keyboard Nodepath check fail, error path: %s", keyboardNodePath.c_str());
|
||||
@@ -208,7 +208,7 @@ void DInputState::CheckMouseKeyState(const int32_t &sessionId, const std::string
|
||||
{
|
||||
DHLOGI("CheckMouseKeyState enter, mouseNodePath %s, mouseNodeDhId %s, sessionId %d.", mouseNodePath.c_str(),
|
||||
GetAnonyString(mouseNodeDhId).c_str(), sessionId);
|
||||
char* canonicalPath = new char(PATH_MAX);
|
||||
char canonicalPath[PATH_MAX] = {0x00};
|
||||
if (mouseNodePath.length() == 0 || mouseNodePath.length() > PATH_MAX ||
|
||||
realpath(mouseNodePath.c_str(), canonicalPath) == nullptr) {
|
||||
DHLOGE("mouse Nodepath check fail, error path: %s", mouseNodePath.c_str());
|
||||
|
||||
@@ -327,8 +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 = new char(PATH_MAX);
|
||||
if (devicePath.length() == 0 || devicePath.length() > PATH_MAX ||
|
||||
char canonicalDevicePath[PATH_MAX] = {0x00};
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user