From f23686596d68c8954c97bc802574410e5d00bbdd Mon Sep 17 00:00:00 2001 From: Lars Date: Thu, 5 Dec 2024 23:25:53 +0100 Subject: [PATCH] in_process_exporter_metrics: fix error logic when directory cannot be opened (#9549) Signed-off-by: Lars-Dominik Braun --- plugins/in_process_exporter_metrics/pe_process.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/in_process_exporter_metrics/pe_process.c b/plugins/in_process_exporter_metrics/pe_process.c index 87a4b42d486..6706e8bd37b 100644 --- a/plugins/in_process_exporter_metrics/pe_process.c +++ b/plugins/in_process_exporter_metrics/pe_process.c @@ -759,8 +759,10 @@ static int process_proc_fds(struct flb_pe *ctx, uint64_t ts, snprintf(fd_procfs, sizeof(fd_procfs) - 1, "%s/%s", process->str, "fd"); dir = opendir(fd_procfs); - if (dir == NULL && errno == EACCES) { - flb_plg_debug(ctx->ins, "NO read access for path: %s", fd_procfs); + if (dir == NULL) { + if (errno == EACCES) { + flb_plg_debug(ctx->ins, "NO read access for path: %s", fd_procfs); + } return -1; }