]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Don't write items to the manager socket twice.
authorMatthew Nicholson <mnicholson@digium.com>
Thu, 17 Mar 2011 14:58:52 +0000 (14:58 +0000)
committerMatthew Nicholson <mnicholson@digium.com>
Thu, 17 Mar 2011 14:58:52 +0000 (14:58 +0000)
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

index 5ab7a37e4c5a72204ce4c1355634c7b0856f6898..2edf2588ba96477591c803d8d06fcde5ecec9d8c 100644 (file)
@@ -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;
        }