Skip to content

Commit

Permalink
Correct stat() error check in decomposition library loading
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nichamon committed Jan 21, 2025
1 parent 4f105db commit 71f02c3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ldms/src/ldmsd/ldmsd_decomp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 71f02c3

Please sign in to comment.