Commit ae8965b97df6dc795f14d7b60a326843a5bfbea0

Stefan Sperling 2019-12-13T10:42:39

add missing fdopendir() error check in read_dirlist()

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/lib/fileindex.c b/lib/fileindex.c
index fb6e5d9..0680a58 100644
--- a/lib/fileindex.c
+++ b/lib/fileindex.c
@@ -860,6 +860,8 @@ read_dirlist(struct got_pathlist_head *dirlist, int dirfd, const char *path)
 		return got_error_from_errno("lseek");
 
 	dir = fdopendir(dirfd);
+	if (dir == NULL)
+		return got_error_from_errno2("fdopendir", path);
 	for (;;) {
 		de = malloc(sizeof(struct dirent) + NAME_MAX + 1);
 		if (de == NULL) {