mirror of
https://github.com/openbsd/src.git
synced 2024-12-22 16:42:56 -08:00
Convert ibuf_write() callers to new simplified return logic.
OK tb@
This commit is contained in:
parent
8f133f76df
commit
4fb4351109
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: mrt.c,v 1.117 2024/05/22 08:41:14 claudio Exp $ */
|
||||
/* $OpenBSD: mrt.c,v 1.118 2024/11/21 13:13:37 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org>
|
||||
@ -1110,9 +1110,7 @@ fail:
|
||||
void
|
||||
mrt_write(struct mrt *mrt)
|
||||
{
|
||||
int r;
|
||||
|
||||
if ((r = ibuf_write(&mrt->wbuf)) == -1 && errno != EAGAIN) {
|
||||
if (ibuf_write(&mrt->wbuf) == -1) {
|
||||
log_warn("mrt dump aborted, mrt_write");
|
||||
mrt_clean(mrt);
|
||||
mrt_done(mrt);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: rtr_proto.c,v 1.41 2024/10/08 12:28:09 claudio Exp $ */
|
||||
/* $OpenBSD: rtr_proto.c,v 1.42 2024/11/21 13:13:37 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org>
|
||||
@ -1260,7 +1260,6 @@ static void
|
||||
rtr_dispatch_msg(struct pollfd *pfd, struct rtr_session *rs)
|
||||
{
|
||||
ssize_t n;
|
||||
int error;
|
||||
|
||||
if (pfd->revents & POLLHUP) {
|
||||
log_warnx("rtr %s: Connection closed, hangup", log_rtr(rs));
|
||||
@ -1273,14 +1272,11 @@ rtr_dispatch_msg(struct pollfd *pfd, struct rtr_session *rs)
|
||||
return;
|
||||
}
|
||||
if (pfd->revents & POLLOUT && msgbuf_queuelen(&rs->w) > 0) {
|
||||
if ((error = ibuf_write(&rs->w)) == -1) {
|
||||
if (errno != EAGAIN) {
|
||||
log_warn("rtr %s: write error", log_rtr(rs));
|
||||
rtr_fsm(rs, RTR_EVNT_CON_CLOSE);
|
||||
}
|
||||
}
|
||||
if (error == 0)
|
||||
if (ibuf_write(&rs->w) == -1) {
|
||||
log_warn("rtr %s: write error", log_rtr(rs));
|
||||
rtr_fsm(rs, RTR_EVNT_CON_CLOSE);
|
||||
return;
|
||||
}
|
||||
if (rs->state == RTR_STATE_ERROR &&
|
||||
msgbuf_queuelen(&rs->w) == 0)
|
||||
rtr_fsm(rs, RTR_EVNT_CON_CLOSE);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: session.c,v 1.486 2024/11/21 13:11:33 claudio Exp $ */
|
||||
/* $OpenBSD: session.c,v 1.487 2024/11/21 13:13:37 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003, 2004, 2005 Henning Brauer <henning@openbsd.org>
|
||||
@ -1935,10 +1935,10 @@ session_dispatch_msg(struct pollfd *pfd, struct peer *p)
|
||||
}
|
||||
|
||||
if (pfd->revents & POLLOUT && msgbuf_queuelen(&p->wbuf) > 0) {
|
||||
if ((error = ibuf_write(&p->wbuf)) <= 0 && errno != EAGAIN) {
|
||||
if (error == 0)
|
||||
if (ibuf_write(&p->wbuf) == -1) {
|
||||
if (errno == EPIPE)
|
||||
log_peer_warnx(&p->conf, "Connection closed");
|
||||
else if (error == -1)
|
||||
else
|
||||
log_peer_warn(&p->conf, "write error");
|
||||
bgp_fsm(p, EVNT_CON_FATAL);
|
||||
return (1);
|
||||
|
Loading…
Reference in New Issue
Block a user