mirror of
https://git.proxmox.com/git/mirror_iproute2
synced 2026-01-07 04:54:44 +00:00
libnetlink: don't return error on success
Change to error handling broke normal code.
Fixes: c60389e4f9 ("libnetlink: fix leak and using unused memory on error")
Reported-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
parent
5dc2204c01
commit
b45e300024
@ -666,17 +666,20 @@ static int __rtnl_talk_iov(struct rtnl_handle *rtnl, struct iovec *iov,
|
||||
if (!err->error)
|
||||
/* check messages from kernel */
|
||||
nl_dump_ext_ack(h, errfn);
|
||||
else {
|
||||
errno = -err->error;
|
||||
|
||||
if (rtnl->proto != NETLINK_SOCK_DIAG &&
|
||||
show_rtnl_err)
|
||||
rtnl_talk_error(h, err, errfn);
|
||||
if (rtnl->proto != NETLINK_SOCK_DIAG &&
|
||||
show_rtnl_err)
|
||||
rtnl_talk_error(h, err, errfn);
|
||||
}
|
||||
|
||||
errno = -err->error;
|
||||
if (answer)
|
||||
*answer = (struct nlmsghdr *)buf;
|
||||
else
|
||||
free(buf);
|
||||
return -i;
|
||||
|
||||
return err->error ? -i : 0;
|
||||
}
|
||||
|
||||
if (answer) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user