diff options
Diffstat (limited to 'libdwfl/linux-pid-attach.c')
| -rw-r--r-- | libdwfl/linux-pid-attach.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libdwfl/linux-pid-attach.c b/libdwfl/linux-pid-attach.c index e6a5c419..1def7f16 100644 --- a/libdwfl/linux-pid-attach.c +++ b/libdwfl/linux-pid-attach.c @@ -52,7 +52,7 @@ linux_proc_pid_is_stopped (pid_t pid) bool retval, have_state; snprintf (buffer, sizeof (buffer), "/proc/%ld/status", (long) pid); - procfile = fopen (buffer, "r"); + procfile = fopen (buffer, "rb"); if (procfile == NULL) return false; @@ -302,7 +302,7 @@ dwfl_linux_proc_attach (Dwfl *dwfl, pid_t pid, bool assume_ptrace_stopped) /* Make sure to report the actual PID (thread group leader) to dwfl_attach_state. */ snprintf (buffer, sizeof (buffer), "/proc/%ld/status", (long) pid); - procfile = fopen (buffer, "r"); + procfile = fopen (buffer, "rb"); if (procfile == NULL) { err = errno; @@ -352,7 +352,7 @@ dwfl_linux_proc_attach (Dwfl *dwfl, pid_t pid, bool assume_ptrace_stopped) Elf *elf; i = snprintf (name, sizeof (name), "/proc/%ld/exe", (long) pid); assert (i > 0 && i < (ssize_t) sizeof (name) - 1); - int elf_fd = open (name, O_RDONLY); + int elf_fd = open (name, O_RDONLY | O_BINARY); if (elf_fd >= 0) { elf = elf_begin (elf_fd, ELF_C_READ_MMAP, NULL); |
