From: Matthew Nicholson Date: Thu, 17 Mar 2011 14:58:52 +0000 (+0000) Subject: Don't write items to the manager socket twice. X-Git-Tag: 1.6.2.19-rc1~3^2~78 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=399854127f5fd55054c1b3397921ec456d28ab2d;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.2@311140 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- 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; }