Re: [PATCH v7 3/9] packed-backend: check whether the "packed-refs" is regular file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 27, 2025 at 08:57:11AM -0800, Junio C Hamano wrote:
> shejialuo <shejialuo@xxxxxxxxx> writes:
> 
> > You are right. Actually, I just want to avoid assigning the `fd` to -1.
> 
> Why not?
> 
> Between leaving it uninitialized and explicitly initializing it to
> signal that it is invalid, the only difference is that you can
> programmatically check if fd is invalid and refrain from calling
> close(fd), for example, with the latter, while with the former you
> cannot.
> 

Yes, that's correct.

> > However, I didn't realize that I would initialize the strbuf later.
> > After waking up, I have suddenly realized this problem.
> 
> Given that initialized-but-never-used strbuf does not hold any
> acquired resources, the current code at the end of the series is
> still OK.  So there is technically nothing to fix.  I'll take a
> reroll if you later send one, but as I said, I do not think it is
> necessary to reroll only to add fd=-1 initialization.

Yes, as you have said, there is nothing wrong at now. And as Patrick has
nothing comment. I have sent out a reroll to make code better.

Thanks,
Jialuo




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux