1
0
mirror of https://github.com/systemd/systemd.git synced 2025-02-07 05:57:46 +03:00

sd-varlink: properly export sd_varlink_reset_fds()

This function was listed in the public sd-varlink.h header, but not
actually made public. Fix that. It's quite useful, the comment in it
describes the usecase nicely.

Fixes: #35554
This commit is contained in:
Lennart Poettering 2024-12-11 13:06:03 +01:00 committed by Yu Watanabe
parent e53be91e5d
commit e11f5aa722
2 changed files with 9 additions and 3 deletions

View File

@ -1059,3 +1059,8 @@ global:
sd_device_monitor_get_timeout;
sd_device_monitor_receive;
} LIBSYSTEMD_256;
LIBSYSTEMD_258 {
global:
sd_varlink_reset_fds;
} LIBSYSTEMD_257;

View File

@ -2496,12 +2496,13 @@ _public_ int sd_varlink_replyb(sd_varlink *v, ...) {
return sd_varlink_reply(v, parameters);
}
static int varlink_reset_fds(sd_varlink *v) {
_public_ int sd_varlink_reset_fds(sd_varlink *v) {
assert_return(v, -EINVAL);
/* Closes all currently pending fds to send. This may be used whenever the caller is in the process
* of putting together a message with fds, and then eventually something fails and they need to
* rollback the fds. Note that this is implicitly called whenever an error reply is sent, see above. */
* rollback the fds. Note that this is implicitly called whenever an error reply is sent, see
* below. */
close_many(v->output_fds, v->n_output_fds);
v->n_output_fds = 0;
@ -2527,7 +2528,7 @@ _public_ int sd_varlink_error(sd_varlink *v, const char *error_id, sd_json_varia
* fails. In that case the pushed fds need to be flushed out again. Under the assumption that it
* never makes sense to send fds along with errors we simply flush them out here beforehand, so that
* the callers don't need to do this explicitly. */
varlink_reset_fds(v);
sd_varlink_reset_fds(v);
r = varlink_sanitize_parameters(&parameters);
if (r < 0)