Handle the return values of realtime updates and stores more accurately.

Realtime backends' update and store callbacks return the number of rows affected,
or -1 if there was a failure. There were a couple of issues:

* The config API was treating 0 as a successful return, and positive values as
  a failure. Now the config API treats anything >= 0 as a success.

* res_sorcery_realtime was treating 0 as a successful return from the store
  procedure, and any positive values as a failure. Now sorcery treats anything
  > 0 as a success. It still considers 0 a "failure" since there is no change
  to report to observers.

Review: https://reviewboard.asterisk.org/r/3341
........

Merged revisions 410592 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410593 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Michelson
2014-03-14 18:11:55 +00:00
parent 1fc33bc795
commit 9665c2d3eb
2 changed files with 5 additions and 5 deletions

View File

@@ -79,7 +79,7 @@ static int sorcery_realtime_create(const struct ast_sorcery *sorcery, void *data
id->next = fields;
fields = id;
return ast_store_realtime_fields(family, fields) ? -1 : 0;
return (ast_store_realtime_fields(family, fields) <= 0) ? -1 : 0;
}
/*! \brief Internal helper function which returns a filtered objectset.