From 399854127f5fd55054c1b3397921ec456d28ab2d Mon Sep 17 00:00:00 2001 From: Matthew Nicholson Date: Thu, 17 Mar 2011 14:58:52 +0000 Subject: [PATCH] Don't write items to the manager socket twice. AST-2011-003 (closes issue 0018987) Reported by: ks-steven git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.2@311140 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- main/manager.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main/manager.c b/main/manager.c index 5ab7a37e4c..2edf2588ba 100644 --- a/main/manager.c +++ b/main/manager.c @@ -966,10 +966,10 @@ struct ast_variable *astman_get_variables(const struct message *m) static int send_string(struct mansession *s, char *string) { int res; + FILE *f = s->f ? s->f : s->session->f; + int fd = s->f ? s->fd : s->session->fd; - if (s->f && (res = ast_careful_fwrite(s->f, s->fd, string, strlen(string), s->session->writetimeout))) { - s->write_error = 1; - } else if ((res = ast_careful_fwrite(s->session->f, s->session->fd, string, strlen(string), s->session->writetimeout))) { + if ((res = ast_careful_fwrite(f, fd, string, strlen(string), s->session->writetimeout))) { s->write_error = 1; } -- 2.47.2