Skip to contentSkip to conversation

cld: return more correct codes

PATCH Applied Pete Zaitcev 2 participants 2 messages Aug 27, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cld: return more correct codes

When doing "ls /foo" in cldcli currently, server reports "invalid inode number". But in fact it's a name that's incorrect, all numbers are fine. It seems we need to return "invalid name" afer we looked up by name, and "invalid number" after we looked up by number (this is ok now and not changed by the patch).

server/msg.c +2 -2
index 6666d3c..4ac806e 100644
@@ -583,7 +583,7 @@ void msg_open(struct msg_params *mp)
 		goto err_out;
 	}
 	if (!create && (rc == DB_NOTFOUND)) {
-		resp_rc = CLE_INODE_INVAL;
+		resp_rc = CLE_NAME_INVAL;
 		goto err_out;
 	}
 	if (create && rc == 0) {
@@ -990,7 +990,7 @@ void msg_del(struct msg_params *mp)
 	rc = cldb_inode_get_byname(txn, name, name_len, &ino, false, 0);
 	if (rc) {
 		if (rc == DB_NOTFOUND)
-			resp_rc = CLE_INODE_INVAL;
+			resp_rc = CLE_NAME_INVAL;
 		else
 			resp_rc = CLE_DB_ERR;
 		goto err_out;
Applied
#1 lore raw
Quoted 7 lines · Pete Zaitcev

When doing "ls /foo" in cldcli currently, server reports "invalid inode number". But in fact it's a name that's incorrect, all numbers are fine. It seems we need to return "invalid name" afer we looked up by name, and "invalid number" after we looked up by number (this is ok now and not changed by the patch).

applied