]> 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:57:49 +0000 (14:57 +0000)
committerMatthew Nicholson <mnicholson@digium.com>
Thu, 17 Mar 2011 14:57:49 +0000 (14:57 +0000)
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

main/manager.c

index 70b2593c39874b22a06afdee1260af8f66a1f7c7..029eb6eb986309b797d901d75b7b8b508e0b6468 100644 (file)
@@ -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;
        }