This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch RHEL7
in repository gfs2-utils.
commit 68568398c79a7e00a411f8960000c0a4d6b86da1
Author: Andrew Price <anprice(a)redhat.com>
Date: Thu Jun 9 11:50:44 2016 +0100
glocktop: Check the return value of fgets()
Fixes 3 occurrences of:
warning: ignoring return value of 'fgets', declared with attribute
warn_unused_result
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/glocktop/glocktop.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/gfs2/glocktop/glocktop.c b/gfs2/glocktop/glocktop.c
index b418d2a..bcee3d8 100644
--- a/gfs2/glocktop/glocktop.c
+++ b/gfs2/glocktop/glocktop.c
@@ -673,11 +673,14 @@ static const char *show_details(const char *id, const char *fsname,
int btype,
memset(dlm_rsbtbl_size, 0, sizeof(dlm_rsbtbl_size));
memset(dlm_lkbtbl_size, 0, sizeof(dlm_lkbtbl_size));
if (!strcmp(sd_sb[mnt_num].sb_lockproto, "lock_dlm")) {
+ char *sp;
char *p;
dlmf = fopen(DLM_DIRTBL, "rt");
if (dlmf) {
- fgets(dlm_dirtbl_size, sizeof(dlm_dirtbl_size), dlmf);
+ sp = fgets(dlm_dirtbl_size, sizeof(dlm_dirtbl_size), dlmf);
+ if (sp == NULL)
+ goto out_err;
p = strchr(dlm_dirtbl_size, '\n');
if (p)
*p = '\0';
@@ -687,7 +690,9 @@ static const char *show_details(const char *id, const char *fsname,
int btype,
}
dlmf = fopen(DLM_RSBTBL, "rt");
if (dlmf) {
- fgets(dlm_rsbtbl_size, sizeof(dlm_rsbtbl_size), dlmf);
+ sp = fgets(dlm_rsbtbl_size, sizeof(dlm_rsbtbl_size), dlmf);
+ if (sp == NULL)
+ goto out_err;
p = strchr(dlm_rsbtbl_size, '\n');
if (p)
*p = '\0';
@@ -697,7 +702,9 @@ static const char *show_details(const char *id, const char *fsname,
int btype,
}
dlmf = fopen(DLM_LKBTBL, "rt");
if (dlmf) {
- fgets(dlm_lkbtbl_size, sizeof(dlm_lkbtbl_size), dlmf);
+ sp = fgets(dlm_lkbtbl_size, sizeof(dlm_lkbtbl_size), dlmf);
+ if (sp == NULL)
+ goto out_err;
p = strchr(dlm_lkbtbl_size, '\n');
if (p)
*p = '\0';
@@ -727,6 +734,9 @@ static const char *show_details(const char *id, const char *fsname,
int btype,
blk_type = "";
}
return blk_type;
+out_err:
+ fclose(dlmf);
+ return "error";
}
static int is_dlm_waiting(int dlmwaiters, int locktype, char *id)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.