From ce286601b0410f0daaeac19f6bcc8dd90c3944a8 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 7 Jul 2020 10:16:25 +1000 Subject: [PATCH] context: log include paths for debugging Now that we're relying on various different include paths, let's log that ones we use and the ones we failed to use. Signed-off-by: Peter Hutterer --- src/context.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/context.c b/src/context.c index fe24516..768fe5c 100644 --- a/src/context.c +++ b/src/context.c @@ -58,19 +58,28 @@ xkb_context_include_path_append(struct xkb_context *ctx, const char *path) goto err; err = stat(path, &stat_buf); - if (err != 0) + if (err != 0) { + err = errno; goto err; - if (!S_ISDIR(stat_buf.st_mode)) + } + if (!S_ISDIR(stat_buf.st_mode)) { + err = ENOTDIR; goto err; + } - if (!check_eaccess(path, R_OK | X_OK)) + if (!check_eaccess(path, R_OK | X_OK)) { + err = EACCES; goto err; + } darray_append(ctx->includes, tmp); + log_dbg(ctx, "Include path added: %s\n", tmp); + return 1; err: darray_append(ctx->failed_includes, tmp); + log_dbg(ctx, "Include path failed: %s (%s)\n", tmp, strerror(err)); return 0; } -- 2.7.4