[PATCH 1/4] Fix gcc-11 compilation warnings on filesys.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Without the patch, the following gcc-11 compilation warnings are
emitted for filesys.c:

filesys.c: In function 'mount_point':
filesys.c:718:17: warning: 'pclose' called on pointer returned from a mismatched allocation function [-Wmismatched-dealloc]
  718 |                 pclose(mp);
      |                 ^~~~~~~~~~
filesys.c:709:27: note: returned from 'fopen'
  709 |                 if ((mp = fopen(mntfile, "r")) == NULL)
      |                           ^~~~~~~~~~~~~~~~~~~
filesys.c:738:17: warning: 'pclose' called on pointer returned from a mismatched allocation function [-Wmismatched-dealloc]
  738 |                 pclose(mp);
      |                 ^~~~~~~~~~
filesys.c:723:27: note: returned from 'fopen'
  723 |                 if ((mp = fopen(mntfile, "r")) == NULL)
      |                           ^~~~~~~~~~~~~~~~~~~

Signed-off-by: Kazuhito Hagio <k-hagio-ab@xxxxxxx>
---
 filesys.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/filesys.c b/filesys.c
index 43cbe82..a863f04 100644
--- a/filesys.c
+++ b/filesys.c
@@ -715,7 +715,7 @@ mount_point(char *name)
 				continue;
 			found++;
 		}
-		pclose(mp);
+		fclose(mp);
 
 		if (!(mount_points = (char **)malloc(sizeof(char *) * found)))
 			return FALSE;
@@ -735,7 +735,7 @@ mount_point(char *name)
                         	mount_points_gathered++, i++;
 			}
                 }
-        	pclose(mp);
+		fclose(mp);
 
 		if (CRASHDEBUG(2))
 			for (i = 0; i < mount_points_gathered; i++)
-- 
2.31.1

--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/crash-utility
Contribution Guidelines: https://github.com/crash-utility/crash/wiki




[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux