summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2015-12-03 05:50:42 -0600
committerGerrit Code Review <gerrit2@gerrit.digium.api>2015-12-03 05:50:43 -0600
commit3b1452b542828c9332fdc6fb03a2fcf4df0fe431 (patch)
treea1833a52647565e75541f050a39d798bc33b66d4 /main
parent53d4f770641fbe7438475b62473d6ddac7a6f451 (diff)
parente7c88e11aa753e046fe58a19ac82320c81cc6e2b (diff)
Merge "sched.c: Make not return a sched id of 0." into 13
Diffstat (limited to 'main')
-rw-r--r--main/sched.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/main/sched.c b/main/sched.c
index e92e3ffd0..f851670af 100644
--- a/main/sched.c
+++ b/main/sched.c
@@ -315,9 +315,16 @@ static int add_ids(struct ast_sched_context *con)
if (!new_id) {
break;
}
- new_id->id = i;
+
+ /*
+ * According to the API doxygen a sched ID of 0 is valid.
+ * Unfortunately, 0 was never returned historically and
+ * several users incorrectly coded usage of the returned
+ * sched ID assuming that 0 was invalid.
+ */
+ new_id->id = ++con->id_queue_size;
+
AST_LIST_INSERT_TAIL(&con->id_queue, new_id, list);
- ++con->id_queue_size;
}
return con->id_queue_size - original_size;