summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main/manager.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/main/manager.c b/main/manager.c
index 36478edb7..74f9eccac 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -1837,6 +1837,9 @@ int ast_hook_send_action(struct manager_custom_hook *hook, const char *msg)
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;
+
/* It's a result from one of the hook's action invocation */
if (s->hook) {
/*
@@ -1845,9 +1848,9 @@ static int send_string(struct mansession *s, char *string)
*/
s->hook->helper(EVENT_FLAG_HOOKRESPONSE, "HookResponse", string);
return 0;
- } else 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;
}