[libvirt] [PATCH v2] replace last instances of close()

Stefan Berger stefanb at linux.vnet.ibm.com
Wed Nov 17 15:21:21 UTC 2010


On 11/17/2010 09:36 AM, Daniel P. Berrange wrote:
> On Tue, Nov 16, 2010 at 09:58:21PM -0500, Stefan Berger wrote:
>> v2:
>>    - added comments about the monitor lock being used to protect the
>> file descriptor 'fd'
>>    - eofcb is not set anywhere, so also removing it; the if statement
>> checking on it seems dead code
>>
>> I am replacing the last instances of close() I found with VIR_CLOSE() /
>> VIR_FORCE_CLOSE respectively.
>>
>> The first part patches virsh, which I missed out on previously.
>>
>> The 2nd patch I had left out intentionally to look at it more carefully:
>> The 'closed' variable could be easily removed since it wasn't used
>> anywhere else. The possible race condition that could result from the
>> filedescriptor being closed and not set to -1 (and possibly let us write
>> into 'something' totally different if the fd was allocated by another
>> thread) seems to be prevented by the qemuMonitorLock() already placed
>> around the code that reads from or writes to the fd. So the change of
>> this code as shown in the patch should not have any side-effects.
>>
>> Signed-off-by: Stefan Berger<stefanb at us.ibm.com>
> ACK
>
>
> Daniel
Pushed.


     Stefan




More information about the libvir-list mailing list