diff options
author | Richard Mudgett <rmudgett@digium.com> | 2015-11-30 16:42:47 -0600 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2015-12-01 13:54:04 -0600 |
commit | ef77439e39fe7bfc894e4ad41b866d3f6cf8f750 (patch) | |
tree | 589b3efc1e68acdc33de69e22876957a72518a46 /main/sched.c | |
parent | 145d10a5d0c1f7a0b6d3fe27462c922d4ca27091 (diff) |
sched.c: Make not return a sched id of 0.
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.
ASTERISK-25476
Change-Id: Ib19c7ebb44ec9fd393ef6646dea806d4f34e3a20
Diffstat (limited to 'main/sched.c')
-rw-r--r-- | main/sched.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/main/sched.c b/main/sched.c index a7e670320..7b7021d61 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; |