From f42c44449ae48730acbacb82efd76831cd44022d Mon Sep 17 00:00:00 2001
From: Matthew Nicholson <mnicholson@digium.com>
Date: Fri, 9 Jan 2009 16:32:34 +0000
Subject: [PATCH] Use ast_safe_system() in logger.c instead of system()

(closes issue #14194)
Reported by: pabelanger


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@168014 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 main/logger.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/main/logger.c b/main/logger.c
index 8a577ed38d..1be97fc87d 100644
--- a/main/logger.c
+++ b/main/logger.c
@@ -74,6 +74,7 @@ static int syslog_level_map[] = {
 #include "asterisk/threadstorage.h"
 #include "asterisk/strings.h"
 #include "asterisk/pbx.h"
+#include "asterisk/app.h"
 
 #if defined(__linux__) && !defined(__NR_gettid)
 #include <asm/unistd.h>
@@ -576,8 +577,8 @@ static int rotate_file(const char *filename)
 		char buf[512];
 		pbx_builtin_setvar_helper(c, "filename", filename);
 		pbx_substitute_variables_helper(c, exec_after_rotate, buf, sizeof(buf));
-		if (system(buf) < 0) {
-			ast_log(LOG_WARNING, "system() failed for '%s': %s\n", buf, strerror(errno));
+		if (ast_safe_system(buf) != -1) {
+			ast_log(LOG_WARNING, "error executing '%s'\n", buf);
 		}
 		ast_channel_free(c);
 	}
-- 
GitLab