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(a)massclouds.com>
> ---
> 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