connection: ignore the CANCEL_FD item on asynchronous messages
authorDjalal Harouni <tixxdz@opendz.org>
Sat, 3 Jan 2015 23:01:04 +0000 (00:01 +0100)
committerDjalal Harouni <tixxdz@opendz.org>
Sat, 3 Jan 2015 23:01:04 +0000 (00:01 +0100)
The doc states that CANCEL_FD should be installed for synchronous, and
for asynchronous messages it should be accepted but ignored, so fix the
code to reflect this.

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
connection.c

index df05ad57289beb80485e854412044f96b3a0bf0e..587983340c6609949cc477ef891f861a24cf4058 100644 (file)
@@ -835,6 +835,10 @@ int kdbus_cmd_msg_send(struct kdbus_conn *conn_src,
                        break;
 
                case KDBUS_ITEM_CANCEL_FD:
+                       /* install cancel_fd only if synchronous */
+                       if (!sync)
+                               break;
+
                        if (cancel_fd) {
                                ret = -EEXIST;
                                goto exit_put_cancelfd;