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

George Joseph asteriskteam at digium.com
Tue Oct 8 08:24:18 CDT 2019


George Joseph has submitted this change and it was merged. ( 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(-)

Approvals:
  Benjamin Keith Ford: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved; Approved for Submit



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-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20191008/c6c49f2d/attachment.html>


More information about the asterisk-code-review mailing list