From 71f02c3ed550bbcec528e1c040fa18b83b3a7b27 Mon Sep 17 00:00:00 2001 From: Nichamon Naksinehaboon Date: Tue, 21 Jan 2025 15:07:47 -0600 Subject: [PATCH] Correct stat() error check in decomposition library loading The original code incorrectly used !stat() which would continue the loop when the library was failed to be loaded (stat returns 0). Change to continue searching for the library when stat() returns a non-zero. Otherwise, an error message is reported. --- ldms/src/ldmsd/ldmsd_decomp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ldms/src/ldmsd/ldmsd_decomp.c b/ldms/src/ldmsd/ldmsd_decomp.c index 60d999817..010162bae 100644 --- a/ldms/src/ldmsd/ldmsd_decomp.c +++ b/ldms/src/ldmsd/ldmsd_decomp.c @@ -125,7 +125,7 @@ static ldmsd_decomp_t decomp_get(const char *decomp, ldmsd_req_ctxt_t reqc) d = dlopen(library_name, RTLD_NOW); if (d) break; - if (!stat(library_name, &st)) + if (0 != stat(library_name, &st)) continue; dlerr = dlerror(); errno = ELIBBAD;