Skip to contentSkip to conversation

fix wrong output with 'info chardev' for tcp socket.

PATCH mdroth 1 participant 1 message Apr 2, 2013 3 messages not in the archive

lore
Share & tools
lore

mdroth

author
#3 lore raw
In reply to a message not in the archive
Quoted 11 lines · mdroth
Quoted 10 lines · Michael Tokarev
Quoted 3 lines · Serge E. Hallyn

The snprintf format isn't taking into account the new 'left' and 'right' variables (for ipv6 []) when placing the ':', which should go immediately before the port.

This fixes actual isse (also found by Serge), where info chardev' prints tcp:127.0.0.14444,server,nowait' for a monitor running on port 4444.

This is definitely a stable material (CCed).

Fix made it upstream through a separate patch:

ec9f828341cb5e9cc3ad0bdbbd6989884daf823a

Quoted 31 lines
Quoted 2 lines
Quoted 26 lines

Thanks!

/mjt

Quoted 19 lines
---
 qemu-char.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
qemu-char.c +1 -1
index e4b0f53..3e152e1 100644
@@ -2482,7 +2482,7 @@ static CharDriverState *qemu_chr_open_socket_fd(int fd, bool do_nodelay,
         s->do_nodelay = do_nodelay;
         getnameinfo((struct sockaddr *) &ss, ss_len, host, sizeof(host),
                     serv, sizeof(serv), NI_NUMERICHOST | NI_NUMERICSERV);
-        snprintf(chr->filename, 256, "%s:%s:%s%s%s%s",
+        snprintf(chr->filename, 256, "%s:%s%s%s:%s%s",
                  is_telnet ? "telnet" : "tcp",
                  left, host, right, serv,
                  is_listen ? ",server" : "");