match: for KDBUS_CMD_MATCH_REMOVE fail with EBADSLT for invalid match entries
authorDjalal Harouni <tixxdz@opendz.org>
Wed, 21 Jan 2015 12:33:37 +0000 (13:33 +0100)
committerDjalal Harouni <tixxdz@opendz.org>
Wed, 21 Jan 2015 12:33:37 +0000 (13:33 +0100)
For KDBUS_CMD_MATCH_REMOVE, if a match entry is not found or invalid
fail with EBADSLT

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
kdbus.txt
match.c
test/test-race.c

index 2be88a923c057eacd90aed3f6f9dc5090b80ba4b..c149ccc8aa874c4aeeb353a1d2699928f4353e4d 100644 (file)
--- a/kdbus.txt
+++ b/kdbus.txt
@@ -2104,7 +2104,7 @@ For KDBUS_CMD_MATCH_ADD:
 For KDBUS_CMD_MATCH_REMOVE:
 
   -EINVAL      Illegal flags
-  -ENOENT      A match entry with the given cookie could not be found.
+  -EBADSLT     A match entry with the given cookie could not be found.
 
 
 15. Internal object relations
diff --git a/match.c b/match.c
index aae9a852ffcc078623234d01d66151c6d5f9c0a9..b1b3731c731bf54ae56c131a494e8d03ac37d448 100644 (file)
--- a/match.c
+++ b/match.c
@@ -326,7 +326,7 @@ static int kdbus_match_db_remove_unlocked(struct kdbus_match_db *mdb,
                        found = true;
                }
 
-       return found ? 0 : -ENOENT;
+       return found ? 0 : -EBADSLT;
 }
 
 /**
index b159711c13c1dd362b33de215e0f075caa312b25..ce8621a5388cc4d03e6b7530f4487fa094fbfb6b 100644 (file)
@@ -284,7 +284,7 @@ TEST_RACE2(kdbus_test_race_byebye_match, 10000,
                cmd.size = sizeof(cmd);
                cmd.cookie = 0xdeadbeef;
                ret = ioctl(env->conn->fd, KDBUS_CMD_MATCH_REMOVE, &cmd);
-               if (ret == 0 || errno == ENOENT)
+               if (ret == 0 || errno == EBADSLT)
                        return 0;
 
                return -errno;