[Asterisk-code-review] cdr_mysql: Don't clean up on unload unless we can unregister from CDRs (...asterisk[13])

Sean Bright asteriskteam at digium.com
Fri Oct 4 16:00:04 CDT 2019


Sean Bright has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/13008


Change subject: cdr_mysql: Don't clean up on unload unless we can unregister from CDRs
......................................................................

cdr_mysql: Don't clean up on unload unless we can unregister from CDRs

ASTERISK-28566 #close

Change-Id: I6daa4e5128e9406d04d3aed670c3bae98d38d40c
---
M addons/cdr_mysql.c
1 file changed, 9 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/08/13008/1

diff --git a/addons/cdr_mysql.c b/addons/cdr_mysql.c
index d72ee09..7fb0b6e 100644
--- a/addons/cdr_mysql.c
+++ b/addons/cdr_mysql.c
@@ -389,6 +389,13 @@
 {
 	struct column *entry;
 
+	if (!reload) {
+		if (ast_cdr_unregister(name)) {
+			/* If we can't unregister the backend, we can't unload the module */
+			return -1;
+		}
+	}
+
 	ast_cli_unregister_multiple(cdr_mysql_status_cli, sizeof(cdr_mysql_status_cli) / sizeof(struct ast_cli_entry));
 
 	if (connected) {
@@ -413,7 +420,8 @@
 	if (reload) {
 		return ast_cdr_backend_suspend(name);
 	} else {
-		return ast_cdr_unregister(name);
+		/* We unregistered earlier */
+		return 0;
 	}
 }
 

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/13008
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: I6daa4e5128e9406d04d3aed670c3bae98d38d40c
Gerrit-Change-Number: 13008
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20191004/536f053e/attachment.html>


More information about the asterisk-code-review mailing list