Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2013-04-03 18:09:28 -0400
committerEugene Tarassov2013-04-03 18:09:28 -0400
commit1eebbe387b39fb57392e35246fed141cfd949510 (patch)
treecb9fa3c51402b924a89118a053e1d377433f068c
parent02490e43d59d2edbea0c721467b6958eef74d5cd (diff)
downloadorg.eclipse.tcf.agent-1eebbe387b39fb57392e35246fed141cfd949510.tar.gz
org.eclipse.tcf.agent-1eebbe387b39fb57392e35246fed141cfd949510.tar.xz
org.eclipse.tcf.agent-1eebbe387b39fb57392e35246fed141cfd949510.zip
TCF Agent: fixed: fstat() returns st_dev = 0 on Windows, which breaks ELF file open logic
-rw-r--r--agent/tcf/services/tcf_elf.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/agent/tcf/services/tcf_elf.c b/agent/tcf/services/tcf_elf.c
index 0bccf7a4..a6cb4971 100644
--- a/agent/tcf/services/tcf_elf.c
+++ b/agent/tcf/services/tcf_elf.c
@@ -511,10 +511,14 @@ static ELF_File * create_elf_cache(const char * file_name) {
add_file_name(file, file_name);
}
+ /* Note: fstat() returns st_dev = 0 on Windows */
+ file->dev = st.st_dev;
+
if (error == 0 && (file->fd = open(file->name, O_RDONLY | O_BINARY, 0)) < 0) error = errno;
if (error == 0 && fstat(file->fd, &st) < 0) error = errno;
+ if (error == 0 && st.st_ino == 0) st.st_ino = elf_ino(file->name);
- file->dev = st.st_dev;
+ if (st.st_dev != 0) file->dev = st.st_dev;
file->ino = st.st_ino;
file->mtime = st.st_mtime;
file->size = st.st_size;

Back to the top