Subject: Re: [PATCH 1/2] t/helper/test-chmtime: update mingw to support chmtime on directories

From: Junio C Hamano <[email-masked]>
Date: Mon, 28 Feb 2022 14:01:46 -0800

Jeff Hostetler <[email-masked]> writes:

>> +	HANDLE osfilehandle;
>
> I'd be more comfortable initializing this variable to
> INVALID_HANDLE_VALUE.

Both directories/files branches assign, so it is not needed.

>> +	if (attrs & FILE_ATTRIBUTE_DIRECTORY) {
>> +		fh = 0;
>
> and here initializing fh = -1.

This does make it safer.

> And then this becomes:
>
> 	if (fh != -1)
> 		close(fh)
> 	else if (osfilehandle != INVALID_HANDLE_VALUE)
> 		Closehandle(osfilehandle);

Exactly.