diff options
| author | Henrik Rydberg <rydberg@euromail.se> | 2010-06-18 01:35:28 +0200 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@euromail.se> | 2010-06-18 01:35:28 +0200 |
| commit | d62c625535494361b8ba0a004a1d24ce485f0b59 (patch) | |
| tree | a71299aa8fe70455663a9854ae26011691c0353b /src/iobuf.c | |
| parent | c9c4f4cda362679567bc4bc04ffedc5d984e2329 (diff) | |
Allow max_events to be zero in mtdev_pull()
When reading from non-blocking devices, it makes sense to read
all events available. This patch lets a zero max_events achieve that.
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'src/iobuf.c')
| -rw-r--r-- | src/iobuf.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/iobuf.c b/src/iobuf.c index 199e0d8..6516a2c 100644 --- a/src/iobuf.c +++ b/src/iobuf.c | |||
| @@ -68,6 +68,8 @@ int mtdev_pull(struct mtdev *dev, int fd, int max_events) | |||
| 68 | struct mtdev_state *state = dev->state; | 68 | struct mtdev_state *state = dev->state; |
| 69 | struct input_event ev; | 69 | struct input_event ev; |
| 70 | int ret, count = 0; | 70 | int ret, count = 0; |
| 71 | if (max_events <= 0) | ||
| 72 | max_events = DIM_EVENTS; | ||
| 71 | while (max_events-- && !evbuf_full(&state->inbuf)) { | 73 | while (max_events-- && !evbuf_full(&state->inbuf)) { |
| 72 | ret = mtdev_fetch(dev, fd, &ev); | 74 | ret = mtdev_fetch(dev, fd, &ev); |
| 73 | if (ret < 0) | 75 | if (ret < 0) |
