commit - b21c4c927df760810943d63b35c0488ce22f755a
commit + 4a4dce94acbf203aec1c6f5ebc1d97ef1f1ad2d4
blob - 79d274191eadea98c7331c63623a96f0e6bb3bbe
blob + 821df8f0bb23ced3c2b8774310e8caf71a0ce1b7
--- usr.sbin/radiusd/radiusd.c
+++ usr.sbin/radiusd/radiusd.c
-/* $OpenBSD: radiusd.c,v 1.42 2024/07/01 05:20:01 yasuoka Exp $ */
+/* $OpenBSD: radiusd.c,v 1.43 2024/07/01 23:53:30 yasuoka Exp $ */
/*
* Copyright (c) 2013, 2023 Internet Initiative Japan Inc.
static void radiusd_module_reset_ev_handler(
struct radiusd_module *);
-static int radiusd_module_imsg_read(struct radiusd_module *,
- bool);
+static int radiusd_module_imsg_read(struct radiusd_module *);
static void radiusd_module_imsg(struct radiusd_module *,
struct imsg *);
if (evmask & EV_WRITE)
module->writeready = true;
- if (evmask & EV_READ || module->ibuf.r.wpos > IMSG_HEADER_SIZE) {
- if (radiusd_module_imsg_read(module,
- (evmask & EV_READ)? true : false) == -1)
+ if (evmask & EV_READ) {
+ if (radiusd_module_imsg_read(module) == -1)
goto on_error;
}
evmask |= EV_WRITE;
else
tvp = &tv; /* fire immediately */
- } else if (module->ibuf.r.wpos > IMSG_HEADER_SIZE)
- tvp = &tv; /* fire immediately */
+ }
/* module stopped and no event handler is set */
if (evmask & EV_WRITE && tvp == NULL && module->stopped) {
}
static int
-radiusd_module_imsg_read(struct radiusd_module *module, bool doread)
+radiusd_module_imsg_read(struct radiusd_module *module)
{
int n;
struct imsg imsg;
- if (doread) {
- if ((n = imsg_read(&module->ibuf)) == -1 || n == 0) {
- if (n == -1 && errno == EAGAIN)
- return (0);
- if (n == -1)
- log_warn("Receiving a message from module `%s' "
- "failed: imsg_read", module->name);
- /* else closed */
- radiusd_module_close(module);
- return (-1);
- }
+ if ((n = imsg_read(&module->ibuf)) == -1 || n == 0) {
+ if (n == -1 && errno == EAGAIN)
+ return (0);
+ if (n == -1)
+ log_warn("Receiving a message from module `%s' "
+ "failed: imsg_read", module->name);
+ /* else closed */
+ radiusd_module_close(module);
+ return (-1);
}
for (;;) {
if ((n = imsg_get(&module->ibuf, &imsg)) == -1) {