From: Matthew Nicholson Date: Thu, 17 Mar 2011 14:57:49 +0000 (+0000) Subject: Don't write items to the manager socket twice. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=32756c5c80ca8af257b31b381bb37822788bb8f4;p=thirdparty%2Fasterisk.git 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.1@311139 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/manager.c b/main/manager.c index 70b2593c39..029eb6eb98 100644 --- a/main/manager.c +++ b/main/manager.c @@ -946,10 +946,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; }