From: Steinar H. Gunderson Date: Tue, 25 Oct 2016 07:41:55 +0000 (+0200) Subject: Check the return value of writing to the eventfd. X-Git-Tag: 1.4.0~2 X-Git-Url: https://git.sesse.net/?p=nageru;a=commitdiff_plain;h=ad9585b7a6671903cadcf6c74491646736db8e1e Check the return value of writing to the eventfd. --- diff --git a/alsa_pool.cpp b/alsa_pool.cpp index 3b6dd7e..bcda163 100644 --- a/alsa_pool.cpp +++ b/alsa_pool.cpp @@ -41,7 +41,10 @@ ALSAPool::~ALSAPool() } should_quit = true; const uint64_t one = 1; - write(should_quit_fd, &one, sizeof(one)); + if (write(should_quit_fd, &one, sizeof(one)) != sizeof(one)) { + perror("write(should_quit_fd)"); + exit(1); + } inotify_thread.join(); while (retry_threads_running > 0) { diff --git a/midi_mapper.cpp b/midi_mapper.cpp index 4f8c33b..a819796 100644 --- a/midi_mapper.cpp +++ b/midi_mapper.cpp @@ -51,7 +51,10 @@ MIDIMapper::~MIDIMapper() { should_quit = true; const uint64_t one = 1; - write(should_quit_fd, &one, sizeof(one)); + if (write(should_quit_fd, &one, sizeof(one)) != sizeof(one)) { + perror("write(should_quit_fd)"); + exit(1); + } midi_thread.join(); close(should_quit_fd); }