[asterisk-dev] [Code Review] Fix DBDelTree error codes for AMI, CLI and AGI

David Lee reviewboard at asterisk.org
Tue Oct 2 10:01:43 CDT 2012


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/2138/
-----------------------------------------------------------

Review request for Asterisk Developers.


Summary
-------

The AMI DBDelTree command will return Success/Key tree deleted successfully even if the given key does not exist. The CLI command 'database deltree' had a similar problem, but was saved because it actually responded with '0 database entries removed'. AGI had a slightly different error, where it would return success if the database was unavailable.

This came from confusion about the ast_db_deltree retval, which is -1 in the event of a database error, or number of entries deleted (including 0 for deleting nothing).

This patch: 
* Adds a Doxygen comment to process_db_keys explaining its retval
* Changed some poorly named res variables to num_deleted
* Specified specific errors when calling ast_db_deltree (database unavailable vs. entry not found vs. success)
* Fixed similar bug in AGI database deltree, where 'Database unavailable' results in successful result


This addresses bug AST-967.
    https://issues.asterisk.org/jira/browse/AST-967


Diffs
-----

  /certified/branches/1.8.15/res/res_agi.c 374105 
  /certified/branches/1.8.15/main/db.c 374105 

Diff: https://reviewboard.asterisk.org/r/2138/diff


Testing
-------

With 1.8.15-certified, verified that AMI's DBDellTree and CLI's database deltree commands both worked with existing key, and failed on non-existing keys.


Thanks,

David

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20121002/8bf9b2e5/attachment.htm>


More information about the asterisk-dev mailing list