Skip to content

Commit fbc18c1

Browse files
authored
Add error description to file open error messages
1 parent 0dbd0ff commit fbc18c1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/pystack/_pystack/elf_common.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ getSectionInfo(const std::string& filename, const std::string& section_name, Sec
401401
LOG(DEBUG) << "Trying to locate .PyRuntime data offset from program headers";
402402
file_unique_ptr file(fopen(filename.c_str(), "r"), fclose);
403403
if (!file || fileno(file.get()) == -1) {
404-
LOG(ERROR) << "Cannot open ELF file " << filename;
404+
LOG(ERROR) << "Cannot open ELF file " << filename << " (" << std::strerror(errno) << ")";
405405
return false;
406406
}
407407
const int fd = fileno(file.get());
@@ -559,7 +559,7 @@ getBuildId(const std::string& filename)
559559
LOG(DEBUG) << "Trying to locate .PyRuntime data offset from program headers";
560560
file_unique_ptr file(fopen(filename.c_str(), "r"), fclose);
561561
if (!file || fileno(file.get()) == -1) {
562-
LOG(ERROR) << "Cannot open ELF file " << filename;
562+
LOG(ERROR) << "Cannot open ELF file " << filename << " (" << std::strerror(errno) << ")";
563563
return "";
564564
}
565565
const int fd = fileno(file.get());

0 commit comments

Comments
 (0)