Fri, May 06, 2016 at 08:06:24AM CEST, jonasj76(a)gmail.com wrote:
From: Greger Wrang <gregermw(a)gmail.com>
The TEAM_OPTION_TYPE_BOOL is handled as a bool in the kernel and as a long in
userspace. On a little endian architecture this is not a problem, but on a big
endian architecture the result will not be correct.
Signed-off-by: Jonas Johansson <jonasj76(a)gmail.com>
There should be sign off of Greger as well. should I add it?
---
libteam/options.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/libteam/options.c b/libteam/options.c
index 79c98d7..2e95aa3 100644
--- a/libteam/options.c
+++ b/libteam/options.c
@@ -259,6 +259,7 @@ int get_options_handler(struct nl_msg *msg, void *arg)
int nla_type;
int opt_type;
long tmp;
+ bool tmp_bool;
void *data;
int data_len = 0;
int err;
@@ -317,8 +318,8 @@ int get_options_handler(struct nl_msg *msg, void *arg)
opt_type = TEAM_OPTION_TYPE_BINARY;
break;
case NLA_FLAG:
- tmp = (long) (data_attr ? true : false);
- data = &tmp;
+ tmp_bool = (bool) (data_attr ? true : false);
you don't need "(bool)" here, just:
tmp_bool = data_attr ? true : false;
>+ data = &tmp_bool;
> opt_type = TEAM_OPTION_TYPE_BOOL;
> break;
> case NLA_S32:
>--
>2.5.0
>