Skip to content
Snippets Groups Projects
Commit d23874e4 authored by Tomáš Pecka's avatar Tomáš Pecka
Browse files

Fix stacktrace when /proc not available (closes #91)

parent 72eb1de9
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -38,7 +38,11 @@ std::string simpleStacktrace(unsigned int max_frames) {
 
/* Now read the symbolic link */
ret = readlink(linkname, buf, 512);
buf[ret] = 0;
if ( ret < 0 ) {
strcpy(buf, "[UNKNOWN]");
} else {
buf[ret] = 0;
}
 
std::stringstream ss;
ss << "stack trace for process " << buf << " (PID:" << pid << "):"<< std::endl;
......@@ -132,3 +136,4 @@ std::string simpleStacktrace(unsigned int max_frames) {
}
 
} /* namespace ext */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment