Blame SOURCES/0010-Fix-gcc-11-compiler-warnings-on-filesys.c.patch

3ce5e9
From 6132fe21e0d5f2951c860f8850aeaacf1588dfb0 Mon Sep 17 00:00:00 2001
3ce5e9
From: Kazuhito Hagio <k-hagio-ab@nec.com>
3ce5e9
Date: Fri, 22 Jul 2022 13:44:50 +0900
3ce5e9
Subject: [PATCH 10/28] Fix gcc-11 compiler warnings on filesys.c
3ce5e9
3ce5e9
Without the patch, the following gcc-11 compiler warnings are emitted
3ce5e9
for filesys.c:
3ce5e9
3ce5e9
filesys.c: In function 'mount_point':
3ce5e9
filesys.c:718:17: warning: 'pclose' called on pointer returned from a mismatched allocation function [-Wmismatched-dealloc]
3ce5e9
  718 |                 pclose(mp);
3ce5e9
      |                 ^~~~~~~~~~
3ce5e9
filesys.c:709:27: note: returned from 'fopen'
3ce5e9
  709 |                 if ((mp = fopen(mntfile, "r")) == NULL)
3ce5e9
      |                           ^~~~~~~~~~~~~~~~~~~
3ce5e9
filesys.c:738:17: warning: 'pclose' called on pointer returned from a mismatched allocation function [-Wmismatched-dealloc]
3ce5e9
  738 |                 pclose(mp);
3ce5e9
      |                 ^~~~~~~~~~
3ce5e9
filesys.c:723:27: note: returned from 'fopen'
3ce5e9
  723 |                 if ((mp = fopen(mntfile, "r")) == NULL)
3ce5e9
      |                           ^~~~~~~~~~~~~~~~~~~
3ce5e9
3ce5e9
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
3ce5e9
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
3ce5e9
---
3ce5e9
 filesys.c | 4 ++--
3ce5e9
 1 file changed, 2 insertions(+), 2 deletions(-)
3ce5e9
3ce5e9
diff --git a/filesys.c b/filesys.c
3ce5e9
index 43cbe826fc79..a863f04eb250 100644
3ce5e9
--- a/filesys.c
3ce5e9
+++ b/filesys.c
3ce5e9
@@ -715,7 +715,7 @@ mount_point(char *name)
3ce5e9
 				continue;
3ce5e9
 			found++;
3ce5e9
 		}
3ce5e9
-		pclose(mp);
3ce5e9
+		fclose(mp);
3ce5e9
 
3ce5e9
 		if (!(mount_points = (char **)malloc(sizeof(char *) * found)))
3ce5e9
 			return FALSE;
3ce5e9
@@ -735,7 +735,7 @@ mount_point(char *name)
3ce5e9
                         	mount_points_gathered++, i++;
3ce5e9
 			}
3ce5e9
                 }
3ce5e9
-        	pclose(mp);
3ce5e9
+		fclose(mp);
3ce5e9
 
3ce5e9
 		if (CRASHDEBUG(2))
3ce5e9
 			for (i = 0; i < mount_points_gathered; i++)
3ce5e9
-- 
3ce5e9
2.37.1
3ce5e9