Welcome! Log In Create A New Profile

Advanced

cppcheck finding

Posted by Илья Шипицин 
Илья Шипицин
cppcheck finding
March 07, 2018 11:30AM
Hello,

[src/proto_uxst.c:160]: (warning) Redundant assignment of
'xfer_sock->next->prev' to itself.

is it in purpose ?
Willy Tarreau
Re: cppcheck finding
March 08, 2018 05:50PM
Hi,

On Wed, Mar 07, 2018 at 03:26:25PM +0500, ???? ??????? wrote:
> Hello,
>
> [src/proto_uxst.c:160]: (warning) Redundant assignment of
> 'xfer_sock->next->prev' to itself.
>
> is it in purpose ?

I suspect it's a mistake and that it was meant to be xfer_sock->prev instead.
CCing Olivier to double-check.

Thanks!
Willy
Olivier Houchard
Re: cppcheck finding
March 08, 2018 06:40PM
Hi,

On Thu, Mar 08, 2018 at 05:44:31PM +0100, Willy Tarreau wrote:
> Hi,
>
> On Wed, Mar 07, 2018 at 03:26:25PM +0500, ???? ??????? wrote:
> > Hello,
> >
> > [src/proto_uxst.c:160]: (warning) Redundant assignment of
> > 'xfer_sock->next->prev' to itself.
> >
> > is it in purpose ?
>
> I suspect it's a mistake and that it was meant to be xfer_sock->prev instead.
> CCing Olivier to double-check.
>

Oops, you're right, good catch !
The attached patch should fix it.

Regards,

Olivier
From 32b505d6093bad96eb4a65272bd3e7b3aad4767b Mon Sep 17 00:00:00 2001
From: Olivier Houchard <[email protected]>
Date: Thu, 8 Mar 2018 18:25:49 +0100
Subject: [PATCH] MINOR: unix: Don't mess up when removing the socket from the
xfer_sock_list.

When removing the socket from the xfer_sock_list, we want to set
next->prev to prev, not to next->prev, which is useless.

This should be backported to 1.8.
---
src/proto_uxst.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/proto_uxst.c b/src/proto_uxst.c
index 3ab637f20..0f717385e 100644
--- a/src/proto_uxst.c
+++ b/src/proto_uxst.c
@@ -157,7 +157,7 @@ static int uxst_find_compatible_fd(struct listener *l)
if (xfer_sock->prev)
xfer_sock->prev->next = xfer_sock->next;
if (xfer_sock->next)
- xfer_sock->next->prev = xfer_sock->next->prev;
+ xfer_sock->next->prev = xfer_sock->prev;
free(xfer_sock);
}
return ret;
--
2.14.3
Илья Шипицин
Re: cppcheck finding
March 14, 2018 02:20PM
any action on that ?

2018-03-08 22:29 GMT+05:00 Olivier Houchard <[email protected]>:

> Hi,
>
> On Thu, Mar 08, 2018 at 05:44:31PM +0100, Willy Tarreau wrote:
> > Hi,
> >
> > On Wed, Mar 07, 2018 at 03:26:25PM +0500, ???? ??????? wrote:
> > > Hello,
> > >
> > > [src/proto_uxst.c:160]: (warning) Redundant assignment of
> > > 'xfer_sock->next->prev' to itself.
> > >
> > > is it in purpose ?
> >
> > I suspect it's a mistake and that it was meant to be xfer_sock->prev
> instead.
> > CCing Olivier to double-check.
> >
>
> Oops, you're right, good catch !
> The attached patch should fix it.
>
> Regards,
>
> Olivier
>
Willy Tarreau
Re: cppcheck finding
March 14, 2018 02:20PM
Hi,

On Wed, Mar 14, 2018 at 06:09:26PM +0500, ???? ??????? wrote:
> any action on that ?

It was merged :
- ec9516a6 in mainline
- 60238357 in 1.8 branch

Thanks,
Willy
Sorry, only registered users may post in this forum.

Click here to login