diff options
Diffstat (limited to 'libdwfl/linux-kernel-modules.c')
| -rw-r--r-- | libdwfl/linux-kernel-modules.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/libdwfl/linux-kernel-modules.c b/libdwfl/linux-kernel-modules.c index 9d0fef2c..4b454d37 100644 --- a/libdwfl/linux-kernel-modules.c +++ b/libdwfl/linux-kernel-modules.c @@ -37,7 +37,6 @@ #endif #include <config.h> -#include <system.h> #include "libdwflP.h" #include <inttypes.h> @@ -49,6 +48,7 @@ #include <sys/utsname.h> #include <fcntl.h> #include <unistd.h> +#include <system.h> /* If fts.h is included before config.h, its indirect inclusions may not give us the right LFS aliases of these functions, so map them manually. */ @@ -97,8 +97,8 @@ try_kernel_name (Dwfl *dwfl, char **fname, bool try_debug) tried because we give its own basename as DEBUGLINK_FILE. */ int fd = ((((dwfl->callbacks->debuginfo_path ? *dwfl->callbacks->debuginfo_path : NULL) - ?: DEFAULT_DEBUGINFO_PATH)[0] == ':') ? -1 - : TEMP_FAILURE_RETRY (open (*fname, O_RDONLY))); + ?: DEFAULT_DEBUGINFO_PATH)[0] == PATHSEP) ? -1 + : TEMP_FAILURE_RETRY (open (*fname, O_RDONLY | O_BINARY))); if (fd < 0) { @@ -133,7 +133,7 @@ try_kernel_name (Dwfl *dwfl, char **fname, bool try_debug) char *zname; if (asprintf (&zname, "%s%s", *fname, vmlinux_suffixes[i]) > 0) { - fd = TEMP_FAILURE_RETRY (open (zname, O_RDONLY)); + fd = TEMP_FAILURE_RETRY (open (zname, O_RDONLY | O_BINARY)); if (fd < 0) free (zname); else @@ -492,7 +492,7 @@ intuit_kernel_bounds (Dwarf_Addr *start, Dwarf_Addr *end, Dwarf_Addr *notes) { struct read_address_state state = { NULL, NULL, 0, 0, NULL, NULL }; - state.f = fopen (KSYMSFILE, "r"); + state.f = fopen (KSYMSFILE, "rb"); if (state.f == NULL) return errno; @@ -535,7 +535,7 @@ static int check_notes (Dwfl_Module *mod, const char *notesfile, Dwarf_Addr vaddr, const char *secname) { - int fd = open (notesfile, O_RDONLY); + int fd = open (notesfile, O_RDONLY | O_BINARY); if (fd < 0) return 1; @@ -793,7 +793,7 @@ dwfl_linux_kernel_find_elf (Dwfl_Module *mod, && (!memcmp (f->fts_name, module_name, namelen) || !memcmp (f->fts_name, alternate_name, namelen))) { - int fd = open (f->fts_accpath, O_RDONLY); + int fd = open (f->fts_accpath, O_RDONLY | O_BINARY); *file_name = strdup (f->fts_path); fts_close (fts); free (modulesdir[0]); @@ -846,7 +846,7 @@ dwfl_linux_kernel_module_section_address if (asprintf (&sysfile, SECADDRDIRFMT "%s", modname, secname) < 0) return DWARF_CB_ABORT; - FILE *f = fopen (sysfile, "r"); + FILE *f = fopen (sysfile, "rb"); free (sysfile); if (f == NULL) @@ -880,7 +880,7 @@ dwfl_linux_kernel_module_section_address if (asprintf (&sysfile, SECADDRDIRFMT "_%s", modname, &secname[1]) < 0) return ENOMEM; - f = fopen (sysfile, "r"); + f = fopen (sysfile, "rb"); free (sysfile); if (f != NULL) goto ok; @@ -900,11 +900,11 @@ dwfl_linux_kernel_module_section_address do { *--end = '\0'; - f = fopen (sysfile, "r"); + f = fopen (sysfile, "rb"); if (is_init && f == NULL && errno == ENOENT) { sysfile[len - namelen] = '_'; - f = fopen (sysfile, "r"); + f = fopen (sysfile, "rb"); sysfile[len - namelen] = '.'; } } @@ -938,7 +938,7 @@ INTDEF (dwfl_linux_kernel_module_section_address) int dwfl_linux_kernel_report_modules (Dwfl *dwfl) { - FILE *f = fopen (MODULELIST, "r"); + FILE *f = fopen (MODULELIST, "rb"); if (f == NULL) return errno; |
