summaryrefslogtreecommitdiff
path: root/bench
diff options
context:
space:
mode:
authorBryce Harrington <bryce@bryceharrington.org>2016-09-15 14:12:38 -0700
committerRan Benita <ran234@gmail.com>2016-09-16 09:23:43 +0300
commitea9a5bcfd7cd20a2ecce4f92915fd537a0a84d90 (patch)
treede7a91e06525df7014d50ea028def82c5bdbe9a7 /bench
parent599fd9ba39f6343644d621bd02a23b2656e91b51 (diff)
downloadxorg-lib-libxkbcommon-ea9a5bcfd7cd20a2ecce4f92915fd537a0a84d90.tar.gz
bench: Check for errors opening Compose file
Otherwise it can segfault e.g. running ./compose inside the bench directory. Signed-off-by: Bryce Harrington <bryce@bryceharrington.org> Signed-off-by: Ran Benita <ran234@gmail.com>
Diffstat (limited to 'bench')
-rw-r--r--bench/compose.c6
1 files changed, 6 insertions, 0 deletions
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);