[systemd-devel] [PATCH 06/12] connection: update attach_flags only if KDBUS_ITEM_ATTACH_FLAGS is provided

Daniel Mack daniel at zonque.org
Fri Jun 20 10:22:51 PDT 2014


On 06/20/2014 06:50 PM, Djalal Harouni wrote:
> Fix a bug introcuded in commit d92d68414fab which fixed another bug.
> 
> conn->attach_flags should only be update if KDBUS_ITEM_ATTACH_FLAGS was
> provided.

Yes, you're right of course.


Applied, thanks!
Daniel


> Signed-off-by: Djalal Harouni <tixxdz at opendz.org>
> ---
>  connection.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/connection.c b/connection.c
> index 3e8c5de..542f677 100644
> --- a/connection.c
> +++ b/connection.c
> @@ -1784,6 +1784,7 @@ int kdbus_cmd_conn_update(struct kdbus_conn *conn,
>  {
>  	const struct kdbus_item *item;
>  	bool policy_provided = false;
> +	bool flags_provided = false;
>  	u64 attach_flags = 0;
>  	int ret;
>  
> @@ -1795,6 +1796,7 @@ int kdbus_cmd_conn_update(struct kdbus_conn *conn,
>  
>  		switch (item->type) {
>  		case KDBUS_ITEM_ATTACH_FLAGS:
> +			flags_provided = true;
>  			attach_flags = item->data64[0];
>  			break;
>  		case KDBUS_ITEM_NAME:
> @@ -1807,7 +1809,8 @@ int kdbus_cmd_conn_update(struct kdbus_conn *conn,
>  	if (!KDBUS_ITEMS_END(item, cmd->items, KDBUS_ITEMS_SIZE(cmd, items)))
>  		return -EINVAL;
>  
> -	conn->attach_flags = attach_flags;
> +	if (flags_provided)
> +		conn->attach_flags = attach_flags;
>  
>  	if (!policy_provided)
>  		return 0;
> 



More information about the systemd-devel mailing list