From: Simon Marchi Date: Thu, 25 Jul 2019 14:09:11 +0000 (-0400) Subject: cli: fix "permission denied" test after g_dir_open X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=d847ef864b2e8a14af0b2b4c926c1cd33768948c;p=babeltrace.git cli: fix "permission denied" test after g_dir_open When changing from opendir/readdir to g_dir_open/g_dir_read_name, I forgot this check from reading errno to reading the error output variable. Change-Id: I95e22531c20ec90df0bc517bbf666f5698cddd15 Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/1781 Reviewed-by: Philippe Proulx --- diff --git a/src/cli/babeltrace2-cfg-src-auto-disc.c b/src/cli/babeltrace2-cfg-src-auto-disc.c index 6dcb9e2c..6b1b4563 100644 --- a/src/cli/babeltrace2-cfg-src-auto-disc.c +++ b/src/cli/babeltrace2-cfg-src-auto-disc.c @@ -525,7 +525,7 @@ int auto_discover_source_for_input_as_dir_or_file_rec(GString *input, const char *fmt = "Failed to open directory %s: %s"; BT_LOGW(fmt, input->str, error->message); - if (errno == EACCES) { + if (error->code == G_FILE_ERROR_ACCES) { /* This is not a fatal error, we just skip it. */ status = 1; goto end;