This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master
in repository gfs2-utils.
commit 0773bf509dd54a6ca95a77674f34258d1a5c9172
Author: Andrew Price <anprice(a)redhat.com>
Date: Mon Apr 9 00:13:58 2018 +0100
glocktop: Fix new -Wformat-overflow warnings
Fixes new warnings in glocktop that appeared in Fedora 28 (gcc 8.0.1 /
glibc 2.27), e.g.:
glocktop.c:1806:30: warning: '_waiters' directive writing 8 bytes
into a region of size between 2 and 4091 [-Wformat-overflow=]
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/glocktop/glocktop.c | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/gfs2/glocktop/glocktop.c b/gfs2/glocktop/glocktop.c
index 0305d3d..7d65ac4 100644
--- a/gfs2/glocktop/glocktop.c
+++ b/gfs2/glocktop/glocktop.c
@@ -921,7 +921,7 @@ static void show_dlm_grants(int locktype, const char *g_line, int dlmgrants,
int summary)
{
int i;
- char dlm_resid[64];
+ char dlm_resid[75];
unsigned int lkb_id, lkbnodeid, remid, ownpid, exflags, flags, status;
unsigned int grmode, rqmode, nodeid, length;
unsigned long long xid, us;
@@ -1596,7 +1596,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[96];
+ char fstitle[96], fsdlm[105];
char ctimestr[64];
time_t t;
int i;
@@ -1652,7 +1652,7 @@ int main(int argc, char **argv)
{
int fd;
DIR *dir = NULL;
- char fn[PATH_MAX];
+ char *fn;
struct dirent *dent;
int retval;
int refresh_time = REFRESH_TIME;
@@ -1772,8 +1772,12 @@ int main(int argc, char **argv)
while (!done) {
struct timeval tv;
- sprintf(fn, "%s/gfs2/", debugfs);
+ if (asprintf(&fn, "%s/gfs2/", debugfs) == -1) {
+ perror(argv[0]);
+ exit(-1);
+ }
dir = opendir(fn);
+ free(fn);
if (!dir) {
if (interactive) {
@@ -1787,7 +1791,7 @@ int main(int argc, char **argv)
display_title_lines();
while ((dent = readdir(dir))) {
const char *fsname;
- char dlm_fn[PATH_MAX];
+ char dlm_fn[PATH_MAX+5+8]; /* "/dlm/" and "_waiters" */
FILE *dlmf;
int dlmfd;
@@ -1822,8 +1826,10 @@ int main(int argc, char **argv)
}
}
- sprintf(fn, "%s/gfs2/%s/glocks", debugfs,
- dent->d_name);
+ if (asprintf(&fn, "%s/gfs2/%s/glocks", debugfs, dent->d_name) == -1) {
+ perror(argv[0]);
+ exit(-1);
+ }
fd = open(fn, O_RDONLY);
if (fd < 0) {
if (interactive) {
@@ -1831,8 +1837,10 @@ int main(int argc, char **argv)
endwin();
}
perror(fn);
+ free(fn);
exit(-1);
}
+ free(fn);
parse_glocks_file(fd, fsname, dlmwaiters, dlmgrants,
trace_dir_path, show_held, help,
summary);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.