This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master in repository gfs2-utils.
commit 0f69624644652732d6bbea75689b0139f5e58dab Author: Alexander Aring aahringo@redhat.com AuthorDate: Thu Mar 11 14:20:36 2021 -0500
glocktop: allocate fsdlm dynamically
This patch allocates the fsdlm string dynamically with respect of dlmwaiters. The fsdlm has at least the dlmwaiters length, the 105 bytes are for some other predicted max length strings.
Signed-off-by: Alexander Aring aahringo@redhat.com --- gfs2/glocktop/glocktop.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/gfs2/glocktop/glocktop.c b/gfs2/glocktop/glocktop.c index 9df87d18..0096a2a5 100644 --- a/gfs2/glocktop/glocktop.c +++ b/gfs2/glocktop/glocktop.c @@ -1605,7 +1605,7 @@ static void parse_glocks_file(int fd, const char *fsname, int dlmwaiters, int dlmgrants, int trace_dir_path, int show_held, int help, int summary) { - char fstitle[96], fsdlm[105]; + char fstitle[96], *fsdlm; char ctimestr[64]; time_t t; int i; @@ -1615,7 +1615,12 @@ static void parse_glocks_file(int fd, const char *fsname, int dlmwaiters, strftime(ctimestr, 64, "%a %b %d %T %Y", localtime(&t)); ctimestr[63] = '\0'; memset(fstitle, 0, sizeof(fstitle)); - memset(fsdlm, 0, sizeof(fsdlm)); + fsdlm = calloc(1, 105 + dlmwaiters); + if (!fsdlm) { + printf("Failed to allocate fsdlm\n"); + exit(-1); + } + sprintf(fstitle, "@ %.22s %s ", fsname, ctimestr); if (dlmwaiters) { sprintf(fsdlm, "dlm: %s/%s/%s [", dlm_dirtbl_size, @@ -1628,6 +1633,7 @@ static void parse_glocks_file(int fd, const char *fsname, int dlmwaiters, } attron(A_BOLD); print_it(NULL, "%s @%s %s", NULL, fstitle, hostname, fsdlm); + free(fsdlm); eol(0); attroff(A_BOLD); glock_details(fd, fsname, dlmwaiters, dlmgrants, trace_dir_path,
cluster-commits@lists.fedorahosted.org