[Asterisk-code-review] test config: Fix failure and segfault when config hook is ru... (asterisk[13])
Corey Farrell
asteriskteam at digium.com
Mon Oct 23 12:46:09 CDT 2017
Corey Farrell has uploaded this change for review. ( https://gerrit.asterisk.org/6876
Change subject: test_config: Fix failure and segfault when config_hook is run twice.
......................................................................
test_config: Fix failure and segfault when config_hook is run twice.
On second run the config_hook test was unexpectedly failing to load
test_config.conf because it was still unmodified since the last load.
This is fixed by not passing CONFIG_FLAG_FILEUNCHANGED for the initial
loads, only using it when we are tested that a reload of unmodified
files do not initiate the hook.
ASTERISK-25960
Change-Id: Ifd679509a23ed163e5cc647490bf7df4ae3cd856
---
M tests/test_config.c
1 file changed, 3 insertions(+), 2 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/76/6876/1
diff --git a/tests/test_config.c b/tests/test_config.c
index 8fb4735..c58bdc7 100644
--- a/tests/test_config.c
+++ b/tests/test_config.c
@@ -959,7 +959,8 @@
{
enum ast_test_result_state res = AST_TEST_FAIL;
enum config_hook_flags hook_flags = { 0, };
- struct ast_flags config_flags = { CONFIG_FLAG_FILEUNCHANGED };
+ struct ast_flags config_flags = { 0 };
+ struct ast_flags reload_flags = { CONFIG_FLAG_FILEUNCHANGED };
struct ast_config *cfg;
switch (cmd) {
@@ -1027,7 +1028,7 @@
* Hook should not run
*/
hook_run = 0;
- cfg = ast_config_load(CONFIG_FILE, config_flags);
+ cfg = ast_config_load(CONFIG_FILE, reload_flags);
/* Only destroy this cfg conditionally. Otherwise a crash happens. */
if (cfg != CONFIG_STATUS_FILEUNCHANGED) {
ast_config_destroy(cfg);
--
To view, visit https://gerrit.asterisk.org/6876
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifd679509a23ed163e5cc647490bf7df4ae3cd856
Gerrit-Change-Number: 6876
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171023/78f299db/attachment.html>
More information about the asterisk-code-review
mailing list