diff --git a/bench/compose.c b/bench/compose.c index 6951bd5..7ff0798 100644 --- a/bench/compose.c +++ b/bench/compose.c @@ -46,7 +46,7 @@ main(void) assert(ctx); path = test_get_path("compose/en_US.UTF-8/Compose"); - file = fopen(path, "r"); + file = fopen(path, "rb"); if (file == NULL) { perror(path); free(path); diff --git a/fuzz/compose/target.c b/fuzz/compose/target.c index a7f15c1..25b4a25 100644 --- a/fuzz/compose/target.c +++ b/fuzz/compose/target.c @@ -31,7 +31,7 @@ main(int argc, char *argv[]) while (__AFL_LOOP(1000)) #endif { - file = fopen(argv[1], "r"); + file = fopen(argv[1], "rb"); assert(file); table = xkb_compose_table_new_from_file(ctx, file, "en_US.UTF-8", diff --git a/fuzz/keymap/target.c b/fuzz/keymap/target.c index e8c6fb5..9984476 100644 --- a/fuzz/keymap/target.c +++ b/fuzz/keymap/target.c @@ -30,7 +30,7 @@ main(int argc, char *argv[]) while (__AFL_LOOP(1000)) #endif { - file = fopen(argv[1], "r"); + file = fopen(argv[1], "rb"); assert(file); keymap = xkb_keymap_new_from_file(ctx, file, XKB_KEYMAP_FORMAT_TEXT_V1, diff --git a/src/compose/parser.c b/src/compose/parser.c index c1ec0f8..0f85a92 100644 --- a/src/compose/parser.c +++ b/src/compose/parser.c @@ -478,7 +478,7 @@ do_include(struct xkb_compose_table *table, struct scanner *s, return false; } - file = fopen(path, "r"); + file = fopen(path, "rb"); if (!file) { scanner_err(s, "failed to open included Compose file \"%s\": %s", path, strerror(errno)); diff --git a/src/compose/paths.c b/src/compose/paths.c index f2a28b4..f37c759 100644 --- a/src/compose/paths.c +++ b/src/compose/paths.c @@ -67,7 +67,7 @@ resolve_name(const char *filename, enum resolve_name_direction direction, if (ret < 0 || (size_t) ret >= sizeof(path)) return false; - file = fopen(path, "r"); + file = fopen(path, "rb"); if (!file) return false; diff --git a/src/compose/table.c b/src/compose/table.c index cba577f..bdfb907 100644 --- a/src/compose/table.c +++ b/src/compose/table.c @@ -178,14 +178,14 @@ xkb_compose_table_new_from_locale(struct xkb_context *ctx, cpath = get_xcomposefile_path(); if (cpath) { - file = fopen(cpath, "r"); + file = fopen(cpath, "rb"); if (file) goto found_path; } cpath = path = get_home_xcompose_file_path(); if (path) { - file = fopen(path, "r"); + file = fopen(path, "rb"); if (file) goto found_path; } @@ -194,7 +194,7 @@ xkb_compose_table_new_from_locale(struct xkb_context *ctx, cpath = path = get_locale_compose_file_path(table->locale); if (path) { - file = fopen(path, "r"); + file = fopen(path, "rb"); if (file) goto found_path; } diff --git a/src/xkbcomp/include.c b/src/xkbcomp/include.c index 56b51cc..8b97558 100644 --- a/src/xkbcomp/include.c +++ b/src/xkbcomp/include.c @@ -233,7 +233,7 @@ FindFileInXkbPath(struct xkb_context *ctx, const char *name, continue; } - file = fopen(buf, "r"); + file = fopen(buf, "rb"); if (file) break; } diff --git a/src/xkbcomp/rules.c b/src/xkbcomp/rules.c index 8d5c266..a4cfe49 100644 --- a/src/xkbcomp/rules.c +++ b/src/xkbcomp/rules.c @@ -411,7 +411,7 @@ matcher_include(struct matcher *m, struct scanner *parent_scanner, return; } - file = fopen(s.buf, "r"); + file = fopen(s.buf, "rb"); if (file) { bool ret = read_rules_file(m->ctx, m, include_depth + 1, file, s.buf); if (!ret) diff --git a/test/common.c b/test/common.c index 1a56521..3784d8b 100644 --- a/test/common.c +++ b/test/common.c @@ -270,7 +270,7 @@ test_compile_file(struct xkb_context *context, const char *path_rel) if (!path) return NULL; - file = fopen(path, "r"); + file = fopen(path, "rb"); if (!file) { fprintf(stderr, "Failed to open path: %s\n", path); free(path); diff --git a/test/compose.c b/test/compose.c index 89b0e7e..37d33bb 100644 --- a/test/compose.c +++ b/test/compose.c @@ -180,7 +180,7 @@ test_seqs(struct xkb_context *ctx) FILE *file; path = test_get_path("compose/en_US.UTF-8/Compose"); - file = fopen(path, "r"); + file = fopen(path, "rb"); assert(file); free(path); @@ -354,7 +354,7 @@ test_state(struct xkb_context *ctx) FILE *file; path = test_get_path("compose/en_US.UTF-8/Compose"); - file = fopen(path, "r"); + file = fopen(path, "rb"); assert(file); free(path); diff --git a/test/interactive-evdev.c b/test/interactive-evdev.c index edf3919..79da5ec 100644 --- a/test/interactive-evdev.c +++ b/test/interactive-evdev.c @@ -445,7 +445,7 @@ main(int argc, char *argv[]) } if (keymap_path) { - FILE *file = fopen(keymap_path, "r"); + FILE *file = fopen(keymap_path, "rb"); if (!file) { ret = EXIT_FAILURE; fprintf(stderr, "Couldn't open '%s': %s\n",