aboutsummaryrefslogtreecommitdiff
path: root/buffer-poll.c
diff options
context:
space:
mode:
Diffstat (limited to 'buffer-poll.c')
-rw-r--r--buffer-poll.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/buffer-poll.c b/buffer-poll.c
index 63b45f47..20ce7b78 100644
--- a/buffer-poll.c
+++ b/buffer-poll.c
@@ -1,4 +1,4 @@
-/* $Id: buffer-poll.c,v 1.18 2009-10-23 17:49:47 tcunha Exp $ */
+/* $Id: buffer-poll.c,v 1.19 2009-11-08 22:40:36 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -19,6 +19,7 @@
#include <sys/types.h>
#include <errno.h>
+#include <event.h>
#include <unistd.h>
#include "tmux.h"
@@ -29,9 +30,7 @@ buffer_poll(int fd, int events, struct buffer *in, struct buffer *out)
{
ssize_t n;
- if (events & (POLLERR|POLLNVAL))
- return (-1);
- if (in != NULL && events & POLLIN) {
+ if (in != NULL && events & EV_READ) {
buffer_ensure(in, BUFSIZ);
n = read(fd, BUFFER_IN(in), BUFFER_FREE(in));
if (n == 0)
@@ -41,9 +40,8 @@ buffer_poll(int fd, int events, struct buffer *in, struct buffer *out)
return (-1);
} else
buffer_add(in, n);
- } else if (events & POLLHUP)
- return (-1);
- if (out != NULL && BUFFER_USED(out) > 0 && events & POLLOUT) {
+ }
+ if (out != NULL && BUFFER_USED(out) > 0 && events & EV_WRITE) {
n = write(fd, BUFFER_OUT(out), BUFFER_USED(out));
if (n == -1) {
if (errno != EINTR && errno != EAGAIN)