Skip to contentSkip to conversation

modified dir-iterator.c

PATCH New sushmaunnibhavi 1 participant 1 message Mar 8, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 modified dir-iterator.c

---
Some places in git use raw API opendir/readdir/closedir to traverse a directory recursively, which usually involves function recursion. Now that we have struct dir_iterator,we have to convert these to use the dir-iterator to simplify the code.

 dir-iterator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
dir-iterator.c +1 -1
index f2dcd82fde..a3b5b8929c 100644
@@ -169,7 +169,7 @@ int dir_iterator_abort(struct dir_iterator *dir_iterator)
 		struct dir_iterator_level *level =
 			&iter->levels[iter->levels_nr - 1];
 
-		if (level->dir && closedir(level->dir)) {
+		if (level->dir && (struct dir_iterator_int *)(level->dir)) {//changed closedir to (struct dir_iterator_int *)
 			strbuf_setlen(&iter->base.path, level->prefix_len);
 			warning("error closing directory %s: %s",
 				iter->base.path.buf, strerror(errno));
Signature · 1 line
2.17.1