atd

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.nihaljere.xyz/atd
Log | Files | Refs

commit c29da1733268ad3f117918efc34072eb0fac75cc
parent 7a066f48fc6d5af9ca44b1be2d1f2c50444e520c
Author: Nihal Jere <nihal@nihaljere.xyz>
Date:   Thu, 29 Apr 2021 22:13:06 -0500

we die if the backend dies

Diffstat:
Matd.c | 7+++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/atd.c b/atd.c @@ -148,8 +148,7 @@ int main(int argc, char *argv[]) goto error; } - int back = connect(backsock, (struct sockaddr *) &backaddr, sizeof(struct sockaddr_un)); - if (back == -1) { + if (connect(backsock, (struct sockaddr *) &backaddr, sizeof(struct sockaddr_un)) == -1) { warn("failed to connect to backend:"); goto error; } @@ -177,7 +176,7 @@ int main(int argc, char *argv[]) fds[STDOUT].events = 0; fds[LISTENER].fd = sock; fds[LISTENER].events = POLLIN; - fds[BACKEND].fd = back; + fds[BACKEND].fd = backsock; fds[BACKEND].events = 0; fds[SIGNALINT].fd = sigintfd; fds[SIGNALINT].events = POLLIN; @@ -188,7 +187,7 @@ int main(int argc, char *argv[]) break; } - if ((fds[SIGNALINT].revents & POLLIN) || fds[LISTENER].revents & POLLHUP) { + if ((fds[SIGNALINT].revents & POLLIN) || (fds[LISTENER].revents & POLLHUP) || (fds[BACKEND].revents & POLLHUP)) { warn("time to die"); break; }