commit ac1a0b445e16cc09128e2ae2b6692d209bb5e81c from: Thomas Adam date: Fri Mar 21 16:30:34 2025 UTC portable: macos: SOCK_CLOEXEC commit - bc18ef3a6de192846f4f2c35aee0012f0dd27afb commit + ac1a0b445e16cc09128e2ae2b6692d209bb5e81c blob - d52dae80c5001553913ee94344f2d7f52c490959 blob + e6717ce86b1654ddd99d88b9b2cb01ebaa3a22ce --- gotd/gotd.c +++ gotd/gotd.c @@ -722,7 +722,12 @@ reload_gotd(struct gotd_client *client, struct imsg *i size_t datalen; char *confpath = NULL; struct gotd_child_proc *proc = NULL; + int sock_flags = SOCK_STREAM | SOCK_NONBLOCK; +#ifdef SOCK_CLOEXEC + sock_flags |= SOCK_CLOEXEC; +#endif + if (client->euid != 0) return got_error_set_errno(EPERM, "reload"); @@ -753,7 +758,7 @@ reload_gotd(struct gotd_client *client, struct imsg *i proc->type = GOTD_PROC_RELOAD; - if (socketpair(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, + if (socketpair(AF_UNIX, sock_flags, PF_UNSPEC, proc->pipe) == -1) { err = got_error_from_errno("socketpair"); free(proc);