mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-06 18:42:48 +08:00
Added return value checking for readlink
This commit is contained in:
@@ -32,8 +32,8 @@ namespace alpr
|
|||||||
char buffer[2048];
|
char buffer[2048];
|
||||||
memset(buffer, 0, sizeof(buffer));
|
memset(buffer, 0, sizeof(buffer));
|
||||||
|
|
||||||
readlink("/proc/self/exe", buffer, sizeof(buffer));
|
if (readlink("/proc/self/exe", buffer, sizeof(buffer)) > 0)
|
||||||
|
{
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << buffer;
|
ss << buffer;
|
||||||
std::string exeFile = ss.str();
|
std::string exeFile = ss.str();
|
||||||
@@ -45,6 +45,11 @@ namespace alpr
|
|||||||
directory = exeFile.substr(0, last_slash_idx);
|
directory = exeFile.substr(0, last_slash_idx);
|
||||||
}
|
}
|
||||||
return directory;
|
return directory;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return "/";
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user