commit 41ddc9d163020f85bddcaf4c7261ab2818848c59 from: claudio date: Thu Nov 21 13:16:06 2024 UTC Convert imsg_write() callers to the new simplified return logic. OK tb@ commit - 1be2558a99f45bf2af156906cd98ba2a7a97198d commit + 41ddc9d163020f85bddcaf4c7261ab2818848c59 blob - cbfad0c2c9d27720aba4fa7a24367a6269313fcf blob + f720329485010ddde62758a78df4b9733cc80af0 --- control.c +++ control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.59 2024/11/21 13:10:49 claudio Exp $ */ +/* $OpenBSD: control.c,v 1.60 2024/11/21 13:16:07 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -239,7 +239,7 @@ control_dispatch_imsg(int fd, short event, void *arg) } if (event & EV_WRITE) { - if (imsg_write(&c->iev.ibuf) <= 0 && errno != EAGAIN) { + if (imsg_write(&c->iev.ibuf) == -1) { control_close(fd, cs); return; } blob - a458cd0a01dddd1da51cf4c24167f27b7d0de7d6 blob + 3424f878da5fdb8775af61c3f81ee02b1e45b260 --- proc.c +++ proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.c,v 1.47 2024/11/21 13:10:49 claudio Exp $ */ +/* $OpenBSD: proc.c,v 1.48 2024/11/21 13:16:07 claudio Exp $ */ /* * Copyright (c) 2010 - 2016 Reyk Floeter @@ -612,13 +612,14 @@ proc_dispatch(int fd, short event, void *arg) } if (event & EV_WRITE) { - if ((n = imsg_write(ibuf)) == -1 && errno != EAGAIN) + if (imsg_write(ibuf) == -1) { + if (errno == EPIPE) { + /* this pipe is dead, remove the handler */ + event_del(&iev->ev); + event_loopexit(NULL); + return; + } fatal("%s: imsg_write", __func__); - if (n == 0) { - /* this pipe is dead, so remove the event handler */ - event_del(&iev->ev); - event_loopexit(NULL); - return; } }