bug-wget
[Top][All Lists]
Advanced

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

Re: [Bug-wget] [PATCH] Update HSTS info


From: Tim Ruehsen
Subject: Re: [Bug-wget] [PATCH] Update HSTS info
Date: Fri, 09 Oct 2015 10:25 +0200
User-agent: KMail/4.14.10 (Linux/4.2.0-1-amd64; KDE/4.14.12; x86_64; ; )

Hi Ander,

thanks for the quick correction.

I pushed both patches after testing flock() / close() behavior.
The docs indeed are not 100% clear.

Regards

        Tim

On Thursday 08 October 2015 20:22:46 Ander Juaristi wrote:
> Hi Tim,
> 
> Thanks for your comments. I re-send the first patch. No changes on the
> second.
> On 10/08/2015 10:37 AM, Tim Ruehsen wrote:
> > +          flock (fd, LOCK_UN);
> > +          fclose (f);
> > You are using buffered I/O, fclose() is effectively a write() + close().
> > That opens a hole here if you unlock the file before write().
> > IMO, to avoid that hole you could just drop the explicit unlock. It will
> > be
> > performed automatically when the file is closed by fclose().
> 
> You were right, the lock is released by fclose(). Obvious, isn't it? I mean,
> that's what one would expect.
> 
> I thought about this but I wasn't really sure. The docs are not 100% clear
> IMO:
> 
>      "Furthermore, the lock is released either by an explicit LOCK_UN
> operation on any of these  duplicate  descriptors, or when all such
> descriptors have been closed."
> 
> Regards,
> - AJ



reply via email to

[Prev in Thread] Current Thread [Next in Thread]