Currently, all use cases of notify_push_fd()/notify_push_fdf()
assume that the name of each fd in the fdstore is unique.
For safety, let's remove the existing fds before pushing a new one
to avoid multiple fds with the same name stored in the fdstore.
if (!state)
return -ENOMEM;
+ /* Remove existing fds with the same name in fdstore. */
+ (void) notify_remove_fd_warn(name);
+
return sd_pid_notify_with_fds(0, /* unset_environment = */ false, state, &fd, 1);
}
if (r < 0)
return log_warning_errno(r, "Failed to finalize serialization file: %m");
- /* Remove the previous serialization to make it replaced with the new one. */
- (void) notify_remove_fd_warn("config-serialization");
-
r = notify_push_fd(fileno(f), "config-serialization");
if (r < 0)
return log_warning_errno(r, "Failed to push serialization fd to service manager: %m");