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

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