diff mbox

[RFC,2/3] chardev: save the passed in 'fd' parameter during parsing

Message ID 576AAE29.8050802@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wei Xu June 22, 2016, 3:26 p.m. UTC
There has been comments on this patch, but i forgot adding this patch to 
the list, just forward it again.

Save the 'fd' paramter as unix socket 'sockfd' member.

Signed-off-by: Wei Xu <wexu@redhat.com>
---
  qemu-char.c | 7 +++++++
  1 file changed, 7 insertions(+)

      const char *port = qemu_opt_get(opts, "port");
@@ -3708,6 +3709,12 @@ static void qemu_chr_parse_socket(QemuOpts *opts, 
ChardevBackend *backend,
          addr->type = SOCKET_ADDRESS_KIND_UNIX;
          q_unix = addr->u.q_unix.data = g_new0(UnixSocketAddress, 1);
          q_unix->path = g_strdup(path);
+
+        if (fd) {
+            q_unix->sockfd = fd;
+        } else {
+            q_unix->sockfd = 0;
+        }
      } else {
          addr->type = SOCKET_ADDRESS_KIND_INET;
          addr->u.inet.data = g_new(InetSocketAddress, 1);
diff mbox

Patch

diff --git a/qemu-char.c b/qemu-char.c
index ea9c02e..8d20494 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -3664,6 +3664,7 @@  static void qemu_chr_parse_socket(QemuOpts *opts, 
ChardevBackend *backend,
      bool is_telnet      = qemu_opt_get_bool(opts, "telnet", false);
      bool do_nodelay     = !qemu_opt_get_bool(opts, "delay", true);
      int64_t reconnect   = qemu_opt_get_number(opts, "reconnect", 0);
+    const int32_t fd = (int32_t)qemu_opt_get_number(opts, "sockfd", 0);
      const char *path = qemu_opt_get(opts, "path");
      const char *host = qemu_opt_get(opts, "host");