msvc: opendir: do not start the search
commit20c6788aced1237489824db3b25285afed0ad169
authorErik Faye-Lund <kusmabite@gmail.com>
Tue, 23 Nov 2010 18:38:26 +0000 (23 19:38 +0100)
committerJunio C Hamano <gitster@pobox.com>
Wed, 24 Nov 2010 00:06:46 +0000 (23 16:06 -0800)
treed7822042223a5355f16a6efb3f581dc662a03b48
parent17194c1e96eddb43d2608fe7bd121256d17118ee
msvc: opendir: do not start the search

compat/mingw.c's readdir expects to be the one that starts the search,
and if it isn't, then the first entry will be missing or incorrect.

Fix this by removing the call to _findfirst, and initializing dd_handle
to INVALID_HANDLE_VALUE.

At the same time, make sure we use FindClose instead of _findclose,
which is symmetric to readdir's FindFirstFile. Take into account that
the find-handle might already be closed by readdir.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
compat/msvc.c