Commit Diff


commit - 6fc93f379e4f736797334532691d298244b2b014
commit + ae8965b97df6dc795f14d7b60a326843a5bfbea0
blob - fb6e5d9eb31559927f1b54206fa50f15527f880b
blob + 0680a583c3947e6fb9275ef5c6b35d865f622f0f
--- lib/fileindex.c
+++ lib/fileindex.c
@@ -860,6 +860,8 @@ read_dirlist(struct got_pathlist_head *dirlist, int di
 		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) {