file descriptor just use -1 there.
OK tb@
-/* $OpenBSD: config.c,v 1.64 2024/01/17 08:20:58 claudio Exp $ */
+/* $OpenBSD: config.c,v 1.65 2024/01/17 08:22:40 claudio Exp $ */
/*
* Copyright (c) 2011 - 2015 Reyk Floeter <reyk@openbsd.org>
struct server_config srv_conf;
uint8_t *p = imsg->data;
size_t s;
+ int fd;
IMSG_SIZE_CHECK(imsg, &srv_conf);
memcpy(&srv_conf, p, sizeof(srv_conf));
/* Reset these variables to avoid free'ing invalid pointers */
serverconfig_reset(&srv_conf);
+ fd = imsg_get_fd(imsg);
+
if ((IMSG_DATA_SIZE(imsg) - s) < (size_t)srv_conf.return_uri_len) {
log_debug("%s: invalid message length", __func__);
goto fail;
if ((srv = server_byaddr((struct sockaddr *)
&srv_conf.ss, srv_conf.port)) != NULL) {
/* Add "host" to existing listening server */
- if (imsg->fd != -1) {
+ if (fd != -1) {
if (srv->srv_s == -1)
- srv->srv_s = imsg->fd;
+ srv->srv_s = fd;
else
- close(imsg->fd);
+ close(fd);
}
return (config_getserver_config(env, srv, imsg));
}
goto fail;
memcpy(&srv->srv_conf, &srv_conf, sizeof(srv->srv_conf));
- srv->srv_s = imsg->fd;
+ srv->srv_s = fd;
if (config_getserver_auth(env, &srv->srv_conf) != 0)
goto fail;
return (0);
fail:
- if (imsg->fd != -1)
- close(imsg->fd);
+ if (fd != -1)
+ close(fd);
if (srv != NULL)
serverconfig_free(&srv->srv_conf);
free(srv);
-/* $OpenBSD: logger.c,v 1.24 2021/01/27 07:21:53 deraadt Exp $ */
+/* $OpenBSD: logger.c,v 1.25 2024/01/17 08:22:40 claudio Exp $ */
/*
* Copyright (c) 2014 Reyk Floeter <reyk@openbsd.org>
TAILQ_FOREACH(log, &log_files, log_entry) {
if (log->log_id == id) {
+ log->log_fd = imsg_get_fd(imsg);
DPRINTF("%s: received log fd %d, file %s",
- __func__, imsg->fd, log->log_name);
- log->log_fd = imsg->fd;
+ __func__, log->log_fd, log->log_name);
return (0);
}
}
-/* $OpenBSD: proc.c,v 1.42 2023/02/15 20:44:01 tobhe Exp $ */
+/* $OpenBSD: proc.c,v 1.43 2024/01/17 08:22:40 claudio Exp $ */
/*
* Copyright (c) 2010 - 2016 Reyk Floeter <reyk@openbsd.org>
case IMSG_CTL_PROCFD:
IMSG_SIZE_CHECK(&imsg, &pf);
memcpy(&pf, imsg.data, sizeof(pf));
- proc_accept(ps, imsg.fd, pf.pf_procid,
+ proc_accept(ps, imsg_get_fd(&imsg), pf.pf_procid,
pf.pf_instance);
break;
default:
enum privsep_procid id, int n)
{
return (proc_compose_imsg(ps, id, n, imsg->hdr.type,
- imsg->hdr.peerid, imsg->fd, imsg->data, IMSG_DATA_SIZE(imsg)));
+ imsg->hdr.peerid, -1, imsg->data, IMSG_DATA_SIZE(imsg)));
}
struct imsgbuf *