Re: [PATCHv2 4/5] util: netdevbridge: use VIR_AUTOCLOSE instead of VIR_FORCE_CLOSE

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

 



On 2018-09-12 at 23:38, Michal Privoznik wrote:
>On 09/12/2018 11:46 AM, Shi Lei wrote:
>> Signed-off-by: Shi Lei <shi_lei@xxxxxxxxxxxxxx>
>> ---
>>  src/util/virnetdevbridge.c | 120 ++++++++++++-------------------------
>>  1 file changed, 37 insertions(+), 83 deletions(-)
>>
>> diff --git a/src/util/virnetdevbridge.c b/src/util/virnetdevbridge.c
>> index ed2db27..e058898 100644
>> --- a/src/util/virnetdevbridge.c
>> +++ b/src/util/virnetdevbridge.c
>
>
>> @@ -723,19 +687,14 @@ int virNetDevBridgeRemovePort(const char *brname,
>>  int virNetDevBridgeSetSTPDelay(const char *brname,
>>                                 int delay)
>>  {
>> -    int fd = -1;
>> -    int ret = -1;
>>      struct ifreq ifr;
>> +    VIR_AUTOCLOSE fd = -1;
>> 
>>      if ((fd = virNetDevSetupControl(brname, &ifr)) < 0)
>> -        goto cleanup;
>> +        return -1;
>> 
>> -    ret = virNetDevBridgeSet(brname, "forward_delay", MS_TO_JIFFIES(delay),
>> +    return virNetDevBridgeSet(brname, "forward_delay", MS_TO_JIFFIES(delay),
>>                               fd, &ifr);
>
>Misaligned arguments. 

Sorry for it!

>
>> -
>> - cleanup:
>> -    VIR_FORCE_CLOSE(fd);
>> -    return ret;
>>  }
>> 
>> 
>> @@ -776,19 +735,14 @@ int virNetDevBridgeGetSTPDelay(const char *brname,
>>  int virNetDevBridgeSetSTP(const char *brname,
>>                            bool enable)
>>  {
>> -    int fd = -1;
>> -    int ret = -1;
>>      struct ifreq ifr;
>> +    VIR_AUTOCLOSE fd = -1;
>> 
>>      if ((fd = virNetDevSetupControl(brname, &ifr)) < 0)
>> -        goto cleanup;
>> +        return -1;
>> 
>> -    ret = virNetDevBridgeSet(brname, "stp_state", enable ? 1 : 0,
>> +    return virNetDevBridgeSet(brname, "stp_state", enable ? 1 : 0,
>>                               fd, &ifr);
>> -
>
>And again. 

Sorry. I would pay attention.

>
>Michal 


Thanks,

Shi Lei

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux