diff mbox

[v3,4/5] block/ssh: Use InetSocketAddress options

Message ID 1476725535-3350-5-git-send-email-ashijeetacharya@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ashijeet Acharya Oct. 17, 2016, 5:32 p.m. UTC
Drop the use of legacy options in favour of the InetSocketAddress
options.

Signed-off-by: Ashijeet Acharya <ashijeetacharya@gmail.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
---
 block/ssh.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Kevin Wolf Oct. 25, 2016, 10:04 a.m. UTC | #1
Am 17.10.2016 um 19:32 hat Ashijeet Acharya geschrieben:
> Drop the use of legacy options in favour of the InetSocketAddress
> options.
> 
> Signed-off-by: Ashijeet Acharya <ashijeetacharya@gmail.com>
> Reviewed-by: Max Reitz <mreitz@redhat.com>

Reviewed-by: Kevin Wolf <kwolf@redhat.com>
diff mbox

Patch

diff --git a/block/ssh.c b/block/ssh.c
index 7963b48..9b693f6 100644
--- a/block/ssh.c
+++ b/block/ssh.c
@@ -199,6 +199,7 @@  static int parse_uri(const char *filename, QDict *options, Error **errp)
 {
     URI *uri = NULL;
     QueryParams *qp;
+    char *port_str;
     int i;
 
     uri = uri_parse(filename);
@@ -231,11 +232,11 @@  static int parse_uri(const char *filename, QDict *options, Error **errp)
         qdict_put(options, "user", qstring_from_str(uri->user));
     }
 
-    qdict_put(options, "host", qstring_from_str(uri->server));
+    qdict_put(options, "server.host", qstring_from_str(uri->server));
 
-    if (uri->port) {
-        qdict_put(options, "port", qint_from_int(uri->port));
-    }
+    port_str = g_strdup_printf("%d", uri->port ?: 22);
+    qdict_put(options, "server.port", qstring_from_str(port_str));
+    g_free(port_str);
 
     qdict_put(options, "path", qstring_from_str(uri->path));