mirror of
https://github.com/clangen/musikcube.git
synced 2025-01-30 15:32:37 +00:00
Merge pull request #116 from mkilgore/readlink-fix
Fix GetApplicationDirectory() null termination error
This commit is contained in:
commit
96b03a2ee9
@ -76,7 +76,7 @@ std::string musik::core::GetApplicationDirectory() {
|
||||
result = result.substr(0, last); /* remove filename component */
|
||||
#else
|
||||
std::string pathToProc = boost::str(boost::format("/proc/%d/exe") % (int) getpid());
|
||||
char pathbuf[PATH_MAX + 1];
|
||||
char pathbuf[PATH_MAX + 1] = { 0 };
|
||||
readlink(pathToProc.c_str(), pathbuf, PATH_MAX);
|
||||
result.assign(pathbuf);
|
||||
size_t last = result.find_last_of("/");
|
||||
|
Loading…
x
Reference in New Issue
Block a user