Skip to content

Commit f84d0ba

Browse files
committed
log_server_close: Only enable the write event, not the read event
We only want to enable the read event if we are expecting a commit point message from the server. Fixes a potential timeout on exit when sending event logs to the server if I/O logging was disabled.
1 parent 921f4f3 commit f84d0ba

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

plugins/sudoers/log_client.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2123,17 +2123,13 @@ log_server_close(struct client_closure *closure, int exit_status, int error)
21232123
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
21242124
goto done;
21252125
}
2126-
2127-
/* Enable read event to receive server messages. */
21282126
closure->read_ev->setbase(closure->read_ev, evbase);
2129-
if (closure->read_ev->add(closure->read_ev,
2130-
&closure->log_details->server_timeout) == -1) {
2131-
sudo_warn("%s", U_("unable to add event to queue"));
2132-
goto done;
2133-
}
2134-
2135-
/* Enable the write event to write the ExitMessage. */
21362127
closure->write_ev->setbase(closure->write_ev, evbase);
2128+
2129+
/*
2130+
* Enable the write event to write the ExitMessage.
2131+
* The read event will be enabled on demand, as needed.
2132+
*/
21372133
if (closure->write_ev->add(closure->write_ev,
21382134
&closure->log_details->server_timeout) == -1) {
21392135
sudo_warn("%s", U_("unable to add event to queue"));

0 commit comments

Comments
 (0)