if (fd < 0)
continue;
- p->stdin_fd = fd;
+ close_and_replace(p->stdin_fd, fd);
} else if ((val = startswith(l, "exec-parameters-stdout-fd="))) {
int fd;
if (fd < 0)
continue;
- p->stdout_fd = fd;
+ close_and_replace(p->stdout_fd, fd);
} else if ((val = startswith(l, "exec-parameters-stderr-fd="))) {
int fd;
if (fd < 0)
continue;
- p->stderr_fd = fd;
+ close_and_replace(p->stderr_fd, fd);
} else if ((val = startswith(l, "exec-parameters-exec-fd="))) {
int fd;
if (fd < 0)
continue;
- p->exec_fd = fd;
+ close_and_replace(p->exec_fd, fd);
} else if ((val = startswith(l, "exec-parameters-handoff-timestamp-fd="))) {
int fd;
if (fd < 0)
continue;
- p->bpf_restrict_fs_map_fd = fd;
+ close_and_replace(p->bpf_restrict_fs_map_fd, fd);
} else if ((val = startswith(l, "exec-parameters-notify-socket="))) {
r = free_and_strdup(&p->notify_socket, val);
if (r < 0)
return r;
} else if ((val = startswith(l, "exec-parameters-open-file="))) {
- OpenFile *of = NULL;
+ OpenFile *of;
r = open_file_parse(val, &of);
if (r < 0)
if (fd < 0)
continue;
- p->user_lookup_fd = fd;
+ close_and_replace(p->user_lookup_fd, fd);
} else if ((val = startswith(l, "exec-parameters-files-env="))) {
r = deserialize_strv(val, &p->files_env);
if (r < 0)
fd = deserialize_fd(fds, val);
if (fd >= 0) {
m->notify_event_source = sd_event_source_disable_unref(m->notify_event_source);
- safe_close(m->notify_fd);
- m->notify_fd = fd;
+ close_and_replace(m->notify_fd, fd);
}
} else if ((val = startswith(l, "notify-socket="))) {
fd = deserialize_fd(fds, val);
if (fd >= 0) {
m->cgroups_agent_event_source = sd_event_source_disable_unref(m->cgroups_agent_event_source);
- safe_close(m->cgroups_agent_fd);
- m->cgroups_agent_fd = fd;
+ close_and_replace(m->cgroups_agent_fd, fd);
}
} else if ((val = startswith(l, "user-lookup="))) {