Skip to content

Commit

Permalink
Fix 'ldms_stream_client_stats_str() error: 2' in ldmsd_controller
Browse files Browse the repository at this point in the history
The error arose from 'ldms_stream_client_stat_str()' on the ldmsd side.

When the stream client list was empty, 'ldms_stream_client_stat_str()'
returned `NULL` with errno=ENOENT. This consequently got forwarded to
`ldmsd_controller` and displayed as an error.

This patch modified ldms_stream_client_stat_str() to return "[]" on
empty client list.
  • Loading branch information
narategithub authored and tom95858 committed Jul 30, 2023
1 parent e3f52ed commit 6ee7812
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ldms/src/core/ldms_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -1821,8 +1821,13 @@ char *ldms_stream_client_stats_str()
struct ldms_stream_client_stats_tq_s *tq;
char *ret = NULL;
tq = ldms_stream_client_stats_tq_get();
if (!tq)
if (!tq) {
if (errno == ENOENT) {
ret = strdup("[]");
return ret;
}
return NULL;
}
ret = ldms_stream_client_stats_tq_to_str(tq);
ldms_stream_client_stats_tq_free(tq);
return ret;
Expand Down

0 comments on commit 6ee7812

Please sign in to comment.