summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/dolmetschctl.c9
-rw-r--r--apps/midi.c4
-rw-r--r--apps/osc.c4
3 files changed, 7 insertions, 10 deletions
diff --git a/apps/dolmetschctl.c b/apps/dolmetschctl.c
index b8f9197..9e3b3d5 100644
--- a/apps/dolmetschctl.c
+++ b/apps/dolmetschctl.c
@@ -65,15 +65,12 @@ int main_loop(osc_t* o, midi_t* m)
printf("main_loop running...\n");
for (;;) {
int err = poll(pfds, npfds, 200);
- if(err < 0) {
- if(errno == EINTR)
- continue;
-
+ if(err < 0 || errno != EINTR) {
error(0, errno, "poll failed");
break;
}
- if(err == 0) {
- // timeout is reached
+ if(err <= 0) {
+ // timeout or EINTR
continue;
}
diff --git a/apps/midi.c b/apps/midi.c
index 821f353..77a6de6 100644
--- a/apps/midi.c
+++ b/apps/midi.c
@@ -61,8 +61,8 @@ int midi_handle_revents(midi_t* m, struct pollfd *pfds, int npfds)
error(0, 0, "MIDI: cannot get poll events: %s", snd_strerror(errno));
return -1;
}
- if(revents & (POLLERR | POLLHUP)) {
- error(0, 0, "MIDI: got POLLERR or POLLHUP");
+ if(pfds[0].revents & (POLLERR | POLLHUP | POLLNVAL)) {
+ error(0, 0, "MIDI: got POLLERR, POLLHUP or POLLNVAL");
return -1;
}
if(!(revents & POLLIN))
diff --git a/apps/osc.c b/apps/osc.c
index 0291af3..887684d 100644
--- a/apps/osc.c
+++ b/apps/osc.c
@@ -85,8 +85,8 @@ int osc_handle_revents(osc_t* o, struct pollfd *pfds, int npfds)
{
assert(npfds == 1);
- if(pfds[0].revents & (POLLERR | POLLHUP)) {
- error(0, 0, "OSC: got POLLERR or POLLHUP");
+ if(pfds[0].revents & (POLLERR | POLLHUP | POLLNVAL)) {
+ error(0, 0, "OSC: got POLLERR, POLLHUP or POLLNVAL");
return -1;
}
if(!(pfds[0].revents & POLLIN))