]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-varlink: properly export sd_varlink_reset_fds()
authorLennart Poettering <lennart@poettering.net>
Wed, 11 Dec 2024 12:06:03 +0000 (13:06 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 11 Dec 2024 20:13:12 +0000 (05:13 +0900)
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
src/libsystemd/libsystemd.sym
src/libsystemd/sd-varlink/sd-varlink.c

index a76dc7e4ae0058dc1e9c97aa8d2fe11bfa309e40..2c0839b8e5e6ea5a9e4581fa4b401c8d40f1c371 100644 (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;
index 7038cba5db57200b3704c07f651c557b4dc601ad..5568388c372c0c34ee7b0bb088e69a76130d205b 100644 (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)