summaryrefslogtreecommitdiffstats
path: root/src/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common.c')
-rw-r--r--src/common.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/common.c b/src/common.c
index 8da909c..b52ee59 100644
--- a/src/common.c
+++ b/src/common.c
@@ -37,7 +37,9 @@ int get_input(struct mansession *s, char *output)
s->inlen = 0;
}
debugmsg("attempting poll operation");
- fds[0].fd = s->fd;
+ /* get actual fd, even if a negative SSL fd */
+ fds[0].fd = get_real_fd(s->fd);
+
fds[0].events = POLLIN;
res = poll(fds, 1, -1);
debugmsg("returned from poll op");
@@ -46,7 +48,9 @@ int get_input(struct mansession *s, char *output)
} else if (res > 0) {
pthread_mutex_lock(&s->lock);
debugmsg("attempting socket read in get_input...");
- res = read(s->fd, s->inbuf + s->inlen, sizeof(s->inbuf) - 1 - s->inlen);
+
+ /* read from socket; SSL or otherwise */
+ res = m_recv(s->fd, s->inbuf + s->inlen, sizeof(s->inbuf) - 1 - s->inlen, 0);
pthread_mutex_unlock(&s->lock);
if (res < 1)
return -1;