Merge "loader: Fix result of module reload error." into 16

This commit is contained in:
George Joseph
2018-10-03 10:19:40 -05:00
committed by Gerrit Code Review

View File

@@ -1443,14 +1443,14 @@ enum ast_module_reload_result ast_module_reload(const char *name)
if (ast_opt_lock_confdir) { if (ast_opt_lock_confdir) {
int try; int try;
int res; int lockres;
for (try = 1, res = AST_LOCK_TIMEOUT; try < 6 && (res == AST_LOCK_TIMEOUT); try++) { for (try = 1, lockres = AST_LOCK_TIMEOUT; try < 6 && (lockres == AST_LOCK_TIMEOUT); try++) {
res = ast_lock_path(ast_config_AST_CONFIG_DIR); lockres = ast_lock_path(ast_config_AST_CONFIG_DIR);
if (res == AST_LOCK_TIMEOUT) { if (lockres == AST_LOCK_TIMEOUT) {
ast_log(LOG_WARNING, "Failed to grab lock on %s, try %d\n", ast_config_AST_CONFIG_DIR, try); ast_log(LOG_WARNING, "Failed to grab lock on %s, try %d\n", ast_config_AST_CONFIG_DIR, try);
} }
} }
if (res != AST_LOCK_SUCCESS) { if (lockres != AST_LOCK_SUCCESS) {
ast_log(AST_LOG_WARNING, "Cannot grab lock on %s\n", ast_config_AST_CONFIG_DIR); ast_log(AST_LOG_WARNING, "Cannot grab lock on %s\n", ast_config_AST_CONFIG_DIR);
res = AST_MODULE_RELOAD_ERROR; res = AST_MODULE_RELOAD_ERROR;
goto module_reload_done; goto module_reload_done;
@@ -1487,6 +1487,8 @@ enum ast_module_reload_result ast_module_reload(const char *name)
ast_verb(3, "Reloading module '%s' (%s)\n", cur->resource, info->description); ast_verb(3, "Reloading module '%s' (%s)\n", cur->resource, info->description);
if (info->reload() == AST_MODULE_LOAD_SUCCESS) { if (info->reload() == AST_MODULE_LOAD_SUCCESS) {
res = AST_MODULE_RELOAD_SUCCESS; res = AST_MODULE_RELOAD_SUCCESS;
} else if (res == AST_MODULE_RELOAD_NOT_FOUND) {
res = AST_MODULE_RELOAD_ERROR;
} }
if (name) { if (name) {
break; break;