From: Lennart Poettering Date: Wed, 11 Dec 2024 12:06:03 +0000 (+0100) Subject: sd-varlink: properly export sd_varlink_reset_fds() X-Git-Tag: v258-rc1~1901 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e11f5aa7226253bf31b2ed61be8599bb213c1819;p=thirdparty%2Fsystemd.git 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 --- diff --git a/src/libsystemd/libsystemd.sym b/src/libsystemd/libsystemd.sym index a76dc7e4ae0..2c0839b8e5e 100644 --- a/src/libsystemd/libsystemd.sym +++ b/src/libsystemd/libsystemd.sym @@ -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; diff --git a/src/libsystemd/sd-varlink/sd-varlink.c b/src/libsystemd/sd-varlink/sd-varlink.c index 7038cba5db5..5568388c372 100644 --- a/src/libsystemd/sd-varlink/sd-varlink.c +++ b/src/libsystemd/sd-varlink/sd-varlink.c @@ -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(¶meters); if (r < 0)