When the user calls nbd_set_socket_activation_name before calling
nbd_connect_system_socket_activation, pass the name down to the server
through LISTEN_FDNAMES.  This has no effect unless the new API has
been called to set the socket name to a non-empty string.

https://lists.nongnu.org/archive/html/qemu-devel/2023-01/msg06114.html

[Original commit message and upstream discussion reference by Rich Jones;
at
<https://listman.redhat.com/archives/libguestfs/2023-January/030558.html>
/ msgid <20230130225521.1771496-5-rjo...@redhat.com>.]

Signed-off-by: Laszlo Ersek <ler...@redhat.com>
---
 generator/states-connect-socket-activation.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/generator/states-connect-socket-activation.c 
b/generator/states-connect-socket-activation.c
index 94d641cde6d9..150b5d6ac005 100644
--- a/generator/states-connect-socket-activation.c
+++ b/generator/states-connect-socket-activation.c
@@ -184,7 +184,7 @@  CONNECT_SA.START:
   struct sockaddr_un addr;
   struct execvpe execvpe_ctx;
   size_t num_vars;
-  struct sact_var sact_var[2];
+  struct sact_var sact_var[3];
   size_t pid_ofs;
   string_vector env;
   pid_t pid;
@@ -244,6 +244,9 @@  CONNECT_SA.START:
                  "LISTEN_PID=", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", &pid_ofs);
   SACT_VAR_PUSH (sact_var, &num_vars,
                  "LISTEN_FDS=", "1", NULL);
+  if (h->sact_name != NULL)
+    SACT_VAR_PUSH (sact_var, &num_vars,
+                   "LISTEN_FDNAMES=", h->sact_name, NULL);
   if (prepare_socket_activation_environment (&env, sact_var, num_vars) == -1) {
     set_error (errno, "prepare_socket_activation_environment");
     goto uninit_execvpe;
_______________________________________________
Libguestfs mailing list
Libguestfs@redhat.com
https://listman.redhat.com/mailman/listinfo/libguestfs

Reply via email to