diff options
author | Marcus Fritzsch <marcus_fritzsch@mentor.com> | 2017-07-04 16:29:05 +0200 |
---|---|---|
committer | Marcus Fritzsch <marcus_fritzsch@mentor.com> | 2017-08-08 17:24:00 +0200 |
commit | 8650d6a9d0adf83220eaa6e4590904a47a2d9d76 (patch) | |
tree | d514ae2c57c3b926eb4e619ee3b3bb120c7a1fa6 | |
parent | d2ad02c40bad6b67f0b38071987ce1fa9f8039ab (diff) |
main: read only one signal and only return -1 if it succeeded
Signed-off-by: Marcus Fritzsch <marcus_fritzsch@mentor.com>
-rw-r--r-- | src/main.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp index ba41a65..80a5c4d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -133,10 +133,11 @@ int main(int /*argc*/, char ** /*argv*/) { sigprocmask(SIG_BLOCK, &sset, nullptr); p.add_fd(sfd.fd, [](int fd) { struct signalfd_siginfo si; - while (read(fd, &si, sizeof(si)) == sizeof(si)) { + if (read(fd, &si, sizeof(si)) == sizeof(si)) { lognotice("Received signal %u", si.ssi_signo); + return -1; } - return -1; + return 0; }); while ((d.flush(), p.check_events()) != -1) { |