connection: make KDBUS_CMD_CONN_UPDATE ioctl available for monitor connections
authorDjalal Harouni <tixxdz@opendz.org>
Sat, 25 Oct 2014 11:30:14 +0000 (12:30 +0100)
committerDjalal Harouni <tixxdz@opendz.org>
Sat, 25 Oct 2014 11:30:14 +0000 (12:30 +0100)
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
connection.c
handle.c
kdbus.txt

index 9e84b45f852faad459696924842ee4c3bf27d6f1..771fdafb7f9e3141217465806e352ed19a331f8a 100644 (file)
@@ -1377,9 +1377,10 @@ int kdbus_cmd_conn_update(struct kdbus_conn *conn,
        KDBUS_ITEMS_FOREACH(item, cmd->items, KDBUS_ITEMS_SIZE(cmd, items)) {
                switch (item->type) {
                case KDBUS_ITEM_ATTACH_FLAGS:
-                       /* Only ordinary connections may update their
-                        * attach-flags */
-                       if (!kdbus_conn_is_connected(conn))
+                       /* Only ordinary or monitor connections
+                        * may update their attach-flags */
+                       if (!kdbus_conn_is_connected(conn) &&
+                           !kdbus_conn_is_monitor(conn))
                                return -EOPNOTSUPP;
 
                        flags_provided = true;
index dabafad7b26308a56f962a1ba30f0181399567f8..97259494910304b65f748b5833c5fb9bf308eae4 100644 (file)
--- a/handle.c
+++ b/handle.c
@@ -886,7 +886,8 @@ static long kdbus_handle_ioctl_ep_connected(struct file *file, unsigned int cmd,
                struct kdbus_cmd_update *cmd_update;
 
                if (!kdbus_conn_is_connected(conn) &&
-                   !kdbus_conn_is_policy_holder(conn)) {
+                   !kdbus_conn_is_policy_holder(conn) &&
+                   !kdbus_conn_is_monitor(conn)) {
                        ret = -EOPNOTSUPP;
                        break;
                }
index 00ee9dd9fa7873b9837835a7afca4b94b0d012f2..b491293acc2a60d07cea94ea39da7d6c4c42486d 100644 (file)
--- a/kdbus.txt
+++ b/kdbus.txt
@@ -1790,7 +1790,7 @@ For KDBUS_CMD_CONN_INFO:
 For KDBUS_CMD_CONN_UPDATE:
 
   -EINVAL      Illegal flags or items
-  -EOPNOTSUPP  Connection is not attached to bus
+  -EOPNOTSUPP  Operation not supported by connection.
   -E2BIG       Too many policy items attached
   -EINVAL      Wildcards submitted in policy entries, or illegal sequence
                of policy items