From 03f68a8a3a9441a78307ca8675aaa32b50098792 Mon Sep 17 00:00:00 2001
From: Jason Parker <jparker@digium.com>
Date: Thu, 27 Dec 2007 23:28:01 +0000
Subject: [PATCH] Fix -s socket option, and document it as well.

Closes issue #11645, patch by Laureano.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@95070 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 doc/asterisk.8  | 6 +++++-
 main/asterisk.c | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/doc/asterisk.8 b/doc/asterisk.8
index 9e0e6880fa..876721a933 100644
--- a/doc/asterisk.8
+++ b/doc/asterisk.8
@@ -12,7 +12,7 @@ asterisk \- All-purpose telephony server.
 \fBasterisk\fR [ \fB-tThfdvVqpRgciIn\fR ] [ \fB-C \fIfile\fB\fR ] [ \fB-U \fIuser\fB\fR ] [ \fB-G \fIgroup\fB\fR ] [ \fB-x \fIcommand\fB\fR ] [ \fB-M \fIvalue\fB\fR ]
 
 
-\fBasterisk -r\fR [ \fB-v\fR ] [ \fB-x \fIcommand\fB\fR ]
+\fBasterisk -r\fR [ \fB-v\fR ] [ \fB-x \fIcommand\fB\fR ] [ \fB-s \fIsocket\fB\fR ]
 
 .SH "DESCRIPTION"
 .PP
@@ -117,6 +117,10 @@ to a running Asterisk process and provide a console interface
 for controlling it. Additionally, if connection to the Asterisk 
 process is lost, attempt to reconnect for as long as 30 seconds.
 .TP
+\fB-s \fIsocket\fB\fR
+Allows to specify the socket file to be used to connect to the
+Asterisk console. Used in conjunction with \fB-r\fR or \fB-R\fR.
+.TP
 \fB-I\fR
 Enable internal timing if Zaptel timer is available
 The default behaviour is that outbound packets are phase locked
diff --git a/main/asterisk.c b/main/asterisk.c
index ea464b76ab..3e1ecad436 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -2851,7 +2851,7 @@ int main(int argc, char *argv[])
 	ast_readconfig();
 
 	if (ast_opt_remote && remotesock != NULL)
-		ast_copy_string((char *) ast_config_AST_SOCKET, remotesock, sizeof(ast_config_AST_SOCKET));
+		ast_copy_string((char *) cfg_paths.socket_path, remotesock, sizeof(cfg_paths.socket_path));
 
 	if (!ast_language_is_prefix && !ast_opt_remote)
 		ast_log(LOG_WARNING, "The 'languageprefix' option in asterisk.conf is deprecated; in a future release it will be removed, and your sound files will need to be organized in the 'new style' language layout.\n");
-- 
GitLab