From c472a68a8ac833f7c986ed04cbfa785d0f2a2da8 Mon Sep 17 00:00:00 2001
From: Jason Parker <jparker@digium.com>
Date: Fri, 26 Oct 2007 21:37:02 +0000
Subject: [PATCH] Correctly use defined return values in (some) load_module
 functions.

(issue #11096)
Patches:
      chan_agent.c.patch uploaded by eliel (license 64)
      chan_local.c.patch uploaded by eliel (license 64)
      chan_features.c.patch uploaded by eliel (license 64)
      chan_zap.c.patch uploaded by eliel (license 64)
      res_monitor.c.patch uploaded by eliel (license 64)
      res_realtime.c.patch uploaded by eliel (license 64)
      res_crypto.c.patch uploaded by eliel (license 64)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@87202 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 channels/chan_agent.c    | 4 ++--
 channels/chan_features.c | 4 ++--
 channels/chan_local.c    | 4 ++--
 channels/chan_zap.c      | 2 +-
 res/res_crypto.c         | 2 +-
 res/res_monitor.c        | 2 +-
 res/res_realtime.c       | 2 +-
 7 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/channels/chan_agent.c b/channels/chan_agent.c
index 8f103ae371..cf1794ac87 100644
--- a/channels/chan_agent.c
+++ b/channels/chan_agent.c
@@ -2339,7 +2339,7 @@ static int load_module(void)
 	/* Make sure we can register our agent channel type */
 	if (ast_channel_register(&agent_tech)) {
 		ast_log(LOG_ERROR, "Unable to register channel class 'Agent'\n");
-		return -1;
+		return AST_MODULE_LOAD_FAILURE;
 	}
 	/* Read in the config */
 	if (!read_agent_config(0))
@@ -2360,7 +2360,7 @@ static int load_module(void)
 	/* Dialplan Functions */
 	ast_custom_function_register(&agent_function);
 
-	return 0;
+	return AST_MODULE_LOAD_SUCCESS;
 }
 
 static int reload(void)
diff --git a/channels/chan_features.c b/channels/chan_features.c
index 4ef9d4125c..27722d3729 100644
--- a/channels/chan_features.c
+++ b/channels/chan_features.c
@@ -551,10 +551,10 @@ static int load_module(void)
 	/* Make sure we can register our sip channel type */
 	if (ast_channel_register(&features_tech)) {
 		ast_log(LOG_ERROR, "Unable to register channel class 'Feature'\n");
-		return -1;
+		return AST_MODULE_LOAD_FAILURE;
 	}
 	ast_cli_register_multiple(cli_features, sizeof(cli_features) / sizeof(struct ast_cli_entry));
-	return 0;
+	return AST_MODULE_LOAD_SUCCESS;
 }
 
 static int unload_module(void)
diff --git a/channels/chan_local.c b/channels/chan_local.c
index 3aa46cf6e5..e79057ee41 100644
--- a/channels/chan_local.c
+++ b/channels/chan_local.c
@@ -732,10 +732,10 @@ static int load_module(void)
 	/* Make sure we can register our channel type */
 	if (ast_channel_register(&local_tech)) {
 		ast_log(LOG_ERROR, "Unable to register channel class 'Local'\n");
-		return -1;
+		return AST_MODULE_LOAD_FAILURE;
 	}
 	ast_cli_register_multiple(cli_local, sizeof(cli_local) / sizeof(struct ast_cli_entry));
-	return 0;
+	return AST_MODULE_LOAD_SUCCESS;
 }
 
 /*! \brief Unload the local proxy channel from Asterisk */
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index f38d862473..9428a43594 100644
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -13070,7 +13070,7 @@ static int load_module(void)
 	if (ast_channel_register(&zap_tech)) {
 		ast_log(LOG_ERROR, "Unable to register channel class 'Zap'\n");
 		__unload_module();
-		return -1;
+		return AST_MODULE_LOAD_FAILURE;
 	}
 #ifdef HAVE_PRI
 	ast_string_field_init(&inuse, 16);
diff --git a/res/res_crypto.c b/res/res_crypto.c
index 9ef65d6528..17b7789c35 100644
--- a/res/res_crypto.c
+++ b/res/res_crypto.c
@@ -617,7 +617,7 @@ static int load_module(void)
 		crypto_load(STDIN_FILENO, STDOUT_FILENO);
 	else
 		crypto_load(-1, -1);
-	return 0;
+	return AST_MODULE_LOAD_SUCCESS;
 }
 
 static int unload_module(void)
diff --git a/res/res_monitor.c b/res/res_monitor.c
index e34b89a404..048bcf1561 100644
--- a/res/res_monitor.c
+++ b/res/res_monitor.c
@@ -722,7 +722,7 @@ static int load_module(void)
 	ast_manager_register2("PauseMonitor", EVENT_FLAG_CALL, pause_monitor_action, pausemonitor_synopsis, pause_monitor_action_help);
 	ast_manager_register2("UnpauseMonitor", EVENT_FLAG_CALL, unpause_monitor_action, unpausemonitor_synopsis, unpause_monitor_action_help);
 
-	return 0;
+	return AST_MODULE_LOAD_SUCCESS;
 }
 
 static int unload_module(void)
diff --git a/res/res_realtime.c b/res/res_realtime.c
index 8f96c8f54b..49f49c5eb6 100644
--- a/res/res_realtime.c
+++ b/res/res_realtime.c
@@ -130,7 +130,7 @@ static int unload_module(void)
 static int load_module(void)
 {
 	ast_cli_register_multiple(cli_realtime, sizeof(cli_realtime) / sizeof(struct ast_cli_entry));
-	return 0;
+	return AST_MODULE_LOAD_SUCCESS;
 }
 
 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Realtime Data Lookup/Rewrite");
-- 
GitLab