[PATCH libxkbcommon] bench: Check for errors opening Compose file
Bryce Harrington
bryce at osg.samsung.com
Thu Sep 15 21:12:38 UTC 2016
From: Bryce Harrington <bryce at bryceharrington.org>
Otherwise it can segfault e.g. running ./compose inside the bench
directory.
Signed-off-by: Bryce Harrington <bryce at bryceharrington.org>
---
bench/compose.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/bench/compose.c b/bench/compose.c
index 267b757..04873a7 100644
--- a/bench/compose.c
+++ b/bench/compose.c
@@ -45,6 +45,12 @@ main(void)
path = test_get_path("compose/en_US.UTF-8/Compose");
file = fopen(path, "r");
+ if (file == NULL) {
+ perror(path);
+ free(path);
+ xkb_context_unref(ctx);
+ return -1;
+ }
xkb_context_set_log_level(ctx, XKB_LOG_LEVEL_CRITICAL);
xkb_context_set_log_verbosity(ctx, 0);
--
1.9.1
More information about the wayland-devel
mailing list