Fixes regression in f53d57c8549dc439eb73354bfd37acd1e4e86cfd Due to an invalid error condition check, a FindFirstFile was not terminated with a FindClose, resulting in a held lock. This meant a sharing violation message was issued if the file/directory was then removed - This was noticed as a subdirectory was not being cleaned up in %temp% at the end of the tests - with the fix on it is correctly cleaned up. Example recreate outside the existing tests mkdir subdir echo something>subdir\bar if exist subdir\ba* echo y del subdir\bar rd subdir Signed-off-by: Jason Edmeades <us(a)edmeades.me.uk> --- programs/cmd/builtins.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c index 57a41c4752..ff58484b9a 100644 --- a/programs/cmd/builtins.c +++ b/programs/cmd/builtins.c @@ -2844,7 +2844,7 @@ void WCMD_if (WCHAR *p, CMD_LIST **cmdList) WIN32_FIND_DATAW fd; HANDLE hff = FindFirstFileW(WCMD_parameter(p, 1+negate, NULL, FALSE, FALSE), &fd); test = (hff != INVALID_HANDLE_VALUE ); - if (!test) FindClose(hff); + if (test) FindClose(hff); WCMD_parameter(p, 2+negate, &command, FALSE, FALSE); } -- 2.17.1