-/* $OpenBSD: radiusd.c,v 1.28 2022/12/28 21:30:18 jmc Exp $ */
+/* $OpenBSD: radiusd.c,v 1.29 2023/09/04 10:50:52 yasuoka Exp $ */
/*
* Copyright (c) 2013 Internet Initiative Japan Inc.
#include <err.h>
#include <errno.h>
#include <event.h>
-#include <fcntl.h>
#include <fnmatch.h>
#include <imsg.h>
#include <md5.h>
{
struct radiusd_module *module = NULL;
pid_t pid;
- int ival, pairsock[] = { -1, -1 };
+ int pairsock[] = { -1, -1 };
const char *av[3];
ssize_t n;
struct imsg imsg;
fatal("Out of memory");
module->radiusd = radiusd;
- if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, pairsock) == -1) {
+ if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK, PF_UNSPEC,
+ pairsock) == -1) {
log_warn("Could not load module `%s'(%s): pipe()", name, path);
goto on_error;
}
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);