summaryrefslogtreecommitdiff
path: root/main/config.c
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2014-03-14 18:11:55 +0000
committerMark Michelson <mmichelson@digium.com>2014-03-14 18:11:55 +0000
commit9665c2d3ebb52c5018a7891b2785cae8f7ef0ddc (patch)
tree9ff634c8de904204480d86009a98a2a1993e6cd6 /main/config.c
parent1fc33bc79502b7df6fffdefa5f56dfd55a98f0b5 (diff)
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
Diffstat (limited to 'main/config.c')
-rw-r--r--main/config.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/main/config.c b/main/config.c
index db9182a46..505a102f7 100644
--- a/main/config.c
+++ b/main/config.c
@@ -2936,8 +2936,8 @@ int ast_update_realtime_fields(const char *family, const char *keyfield, const c
for (i = 1; ; i++) {
if ((eng = find_engine(family, i, db, sizeof(db), table, sizeof(table)))) {
- /* If the update succeeds, it returns 0. */
- if (eng->update_func && !(res = eng->update_func(db, table, keyfield, lookup, fields))) {
+ /* If the update succeeds, it returns >= 0. */
+ if (eng->update_func && ((res = eng->update_func(db, table, keyfield, lookup, fields)) >= 0)) {
break;
}
} else {
@@ -3017,8 +3017,8 @@ int ast_store_realtime_fields(const char *family, const struct ast_variable *fie
for (i = 1; ; i++) {
if ((eng = find_engine(family, i, db, sizeof(db), table, sizeof(table)))) {
- /* If the store succeeds, it returns 0. */
- if (eng->store_func && !(res = eng->store_func(db, table, fields))) {
+ /* If the store succeeds, it returns >= 0*/
+ if (eng->store_func && ((res = eng->store_func(db, table, fields)) >= 0)) {
break;
}
} else {