File libhugetlbfs_PR74.patch of Package libhugetlbfs

From e8a5d257e63c0f745fb2ad0cf02fddcf12408df7 Mon Sep 17 00:00:00 2001
From: Jakub Duchniewicz <j.duchniewicz@gmail.com>
Date: Thu, 13 Oct 2022 14:28:41 +0200
Subject: [PATCH] Add closing the fd when exiting from gethugepagesizes

---
 hugeutils.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hugeutils.c b/hugeutils.c
index 0230976..6bf91fd 100644
--- a/hugeutils.c
+++ b/hugeutils.c
@@ -934,7 +934,10 @@ int gethugepagesizes(long pagesizes[], int n_elem)
 		if (size < 0 || size == default_size)
 			continue;
 		if (pagesizes && (nr_sizes == n_elem))
+		{	
+			closedir(sysfs);
 			return nr_sizes;
+		}
 		if (pagesizes)
 			pagesizes[nr_sizes] = size;
 		nr_sizes++;
openSUSE Build Service is sponsored by