Mercurial > irccd
changeset 273:7069219bf764
Irccd: fix unkillable daemon and add handler for SIGQUIT
author | David Demelier <markand@malikania.fr> |
---|---|
date | Wed, 28 Sep 2016 13:15:06 +0200 |
parents | 8fb6bd57878c |
children | 750157368a42 |
files | irccd/main.cpp lib/irccd/pollable.hpp |
diffstat | 2 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/irccd/main.cpp Wed Sep 28 13:00:38 2016 +0200 +++ b/irccd/main.cpp Wed Sep 28 13:15:06 2016 +0200 @@ -85,6 +85,10 @@ signal(SIGINT, stop); signal(SIGTERM, stop); +#if defined(SIGQUIT) + signal(SIGQUIT, stop); +#endif + -- argc; ++ argv; }
--- a/lib/irccd/pollable.hpp Wed Sep 28 13:00:38 2016 +0200 +++ b/lib/irccd/pollable.hpp Wed Sep 28 13:15:06 2016 +0200 @@ -105,8 +105,10 @@ net::Handle max = 0; prepare(in, out, max); - select(max + 1, &in, &out, nullptr, timeout < 0 ? nullptr : &tv); - sync(in, out); + + // Timeout or error are discarded. + if (::select(max + 1, &in, &out, nullptr, timeout < 0 ? nullptr : &tv) > 0) + sync(in, out); } };