Commit ee63bca5258374c93ee2b34459f4ad0c08958daf

Duncan Overbruck 2024-03-05T17:01:29

closefrom: Ignore files starting with dot when scanning /proc/self/fd Signed-off-by: Guillem Jover <guillem@hadrons.org>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/src/closefrom.c b/src/closefrom.c
index 2df5d03..41c9668 100644
--- a/src/closefrom.c
+++ b/src/closefrom.c
@@ -153,6 +153,9 @@ closefrom_procfs(int lowfd)
 		const char *errstr;
 		int fd;
 
+		if (dent->d_name[0] == '.')
+			continue;
+
 		fd = strtonum(dent->d_name, lowfd, INT_MAX, &errstr);
 		if (errstr != NULL || fd == dirfd(dirp))
 			continue;