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

2014-06-20 Thread Djalal Harouni
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.

Signed-off-by: Djalal Harouni tix...@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;
-- 
1.9.0

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


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

2014-06-20 Thread Daniel Mack
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 tix...@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;
 

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel