cld: return more correct codes
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).
Signed-off-by Pete Zaitcev <[email protected]>
server/msg.c +2 -2
@@ -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;
Jeff Garzik
AppliedQuoted 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).
Signed-off-by Pete Zaitcev<[email protected]>
applied