From: Marcus Fritzsch Date: Tue, 4 Jul 2017 14:29:05 +0000 (+0200) Subject: main: read only one signal and only return -1 if it succeeded X-Git-Tag: 4.99.1~271 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=commitdiff_plain;h=8650d6a9d0adf83220eaa6e4590904a47a2d9d76;p=staging%2Fwindowmanager.git main: read only one signal and only return -1 if it succeeded Signed-off-by: Marcus Fritzsch --- 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) {