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

Friendly Automation asteriskteam at digium.com
Tue Oct 8 07:27:32 CDT 2019


Friendly Automation has submitted this change and it was merged. ( https://gerrit.asterisk.org/c/asterisk/+/13011 )

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
  Friendly Automation: Approved for Submit



diff --git a/addons/cdr_mysql.c b/addons/cdr_mysql.c
index 61d5d5c..3f67dd5 100644
--- a/addons/cdr_mysql.c
+++ b/addons/cdr_mysql.c
@@ -382,6 +382,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) {
@@ -406,7 +413,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/+/13011
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I6daa4e5128e9406d04d3aed670c3bae98d38d40c
Gerrit-Change-Number: 13011
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/a20f8be7/attachment.html>


More information about the asterisk-code-review mailing list