1
0
mirror of https://github.com/openbsd/src.git synced 2026-06-18 07:13:36 +02:00

Revert previous. It caused the stdio of the modules be NONBLOCK.

Generally programs don't expect that.
This commit is contained in:
yasuoka
2023-09-04 23:55:23 +00:00
parent 94687c0059
commit ab3cfbd93e
+14 -4
View File
@@ -1,4 +1,4 @@
/* $OpenBSD: radiusd.c,v 1.29 2023/09/04 10:50:52 yasuoka Exp $ */
/* $OpenBSD: radiusd.c,v 1.30 2023/09/04 23:55:23 yasuoka Exp $ */
/*
* Copyright (c) 2013 Internet Initiative Japan Inc.
@@ -27,6 +27,7 @@
#include <err.h>
#include <errno.h>
#include <event.h>
#include <fcntl.h>
#include <fnmatch.h>
#include <imsg.h>
#include <md5.h>
@@ -918,7 +919,7 @@ radiusd_module_load(struct radiusd *radiusd, const char *path, const char *name)
{
struct radiusd_module *module = NULL;
pid_t pid;
int pairsock[] = { -1, -1 };
int ival, pairsock[] = { -1, -1 };
const char *av[3];
ssize_t n;
struct imsg imsg;
@@ -928,8 +929,7 @@ radiusd_module_load(struct radiusd *radiusd, const char *path, const char *name)
fatal("Out of memory");
module->radiusd = radiusd;
if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK, PF_UNSPEC,
pairsock) == -1) {
if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, pairsock) == -1) {
log_warn("Could not load module `%s'(%s): pipe()", name, path);
goto on_error;
}
@@ -956,6 +956,16 @@ radiusd_module_load(struct radiusd *radiusd, const char *path, const char *name)
close(pairsock[1]);
module->fd = pairsock[0];
if ((ival = fcntl(module->fd, F_GETFL)) == -1) {
log_warn("Could not load module `%s': fcntl(F_GETFL)",
name);
goto on_error;
}
if (fcntl(module->fd, F_SETFL, ival | O_NONBLOCK) == -1) {
log_warn("Could not load module `%s': fcntl(F_SETFL,O_NONBLOCK)",
name);
goto on_error;
}
strlcpy(module->name, name, sizeof(module->name));
module->pid = pid;
imsg_init(&module->ibuf, module->fd);