change error message of BYEBYE to -EBUSY
authorDaniel Mack <zonque@gmail.com>
Fri, 20 Dec 2013 22:25:16 +0000 (23:25 +0100)
committerDaniel Mack <zonque@gmail.com>
Fri, 20 Dec 2013 22:25:16 +0000 (23:25 +0100)
connection.c
kdbus.h
test/test-kdbus.c

index 87b362e7da5382a85ecfd467cafc95b71e91c862..e1b99122c1547436ea8c049dcab971b96ce749ee 100644 (file)
@@ -1090,7 +1090,7 @@ exit_unlock:
  *
  * Returns 0 on success.
  * If @ensure_msg_list_empty is true, and the connection has pending messages,
- * -EAGAIN is returned.
+ * -EBUSY is returned.
  */
 int kdbus_conn_disconnect(struct kdbus_conn *conn, bool ensure_msg_list_empty)
 {
@@ -1106,7 +1106,7 @@ int kdbus_conn_disconnect(struct kdbus_conn *conn, bool ensure_msg_list_empty)
 
        if (ensure_msg_list_empty && !list_empty(&conn->msg_list)) {
                mutex_unlock(&conn->lock);
-               return -EAGAIN;
+               return -EBUSY;
        }
 
        conn->disconnected = true;
diff --git a/kdbus.h b/kdbus.h
index 61dc33d8d5b7b8cfab4dc24df6f838b7a8924326..f6770dd5cbac9751c2b6f7a0dd0c513002ee44a7 100644 (file)
--- a/kdbus.h
+++ b/kdbus.h
@@ -765,6 +765,8 @@ enum kdbus_ioctl_type {
  * @EBADFD:            A bus connection is in a corrupted state.
  * @EBADMSG:           Passed data contains a combination of conflicting or
  *                     inconsistent types.
+ * @EBUSY:             The user tried to say BYEBYE to a connection, but the
+ *                     connection had a non-empty message list.
  * @ECONNRESET:                A connection is shut down, no further operations are
  *                     possible.
  * @ECOMM:             A peer does not accept the file descriptors addressed
index e6cdfd2cd910142d018f8886ad73eff2cb17a202..89b1101191dd5c1c6ac47ffe7b49a7614eb4f271 100644 (file)
@@ -443,7 +443,7 @@ static int check_byebye(struct kdbus_check_env *env)
 
        /* say byebye on the 2nd, which must fail */
        ret = ioctl(conn->fd, KDBUS_CMD_BYEBYE, 0);
-       ASSERT_RETURN(ret == -1 && errno == EAGAIN);
+       ASSERT_RETURN(ret == -1 && errno == EBUSY);
 
        /* receive the message */
        ret = ioctl(conn->fd, KDBUS_CMD_MSG_RECV, &off);