vnc: fix "info vnc" with "-vnc ..., reverse=on"

When reverse connection is in use, there is no active VNC server
socket.  Because of this, getsockopt(-1, ...) is attempted and
the following error is emitted:

    $ socat TCP-LISTEN:5900,reuseaddr TCP-LISTEN:5901,reuseaddr &
    $ x86_64-softmmu/qemu-system-x86_64 -vnc localhost:5900,reverse -monitor stdio
    QEMU 1.2.50 monitor - type 'help' for more information
    (qemu) info vnc
    An undefined error has occurred

Because however the host, family, service and auth fields are
optional, we can just exit if there is no active server socket.

    $ x86_64-softmmu/qemu-system-x86_64 -vnc localhost:5900,reverse -monitor stdio
    QEMU 1.2.50 monitor - type 'help' for more information
    (qemu) info vnc
    Server:
    Client:
         address: 127.0.0.1:5900
      x509_dname: none
        username: none

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
1 file changed
tree: e6848370d52ed500ae01feb5f8e9412b4d250470
  1. audio/
  2. block/
  3. bsd-user/
  4. default-configs/
  5. docs/
  6. fpu/
  7. fsdev/
  8. gdb-xml/
  9. hw/
  10. include/
  11. libcacard/
  12. linux-headers/
  13. linux-user/
  14. net/
  15. pc-bios/
  16. qapi/
  17. qga/
  18. QMP/
  19. qom/
  20. roms/
  21. scripts/
  22. slirp/
  23. sysconfigs/
  24. target-alpha/
  25. target-arm/
  26. target-cris/
  27. target-i386/
  28. target-lm32/
  29. target-m68k/
  30. target-microblaze/
  31. target-mips/
  32. target-openrisc/
  33. target-ppc/
  34. target-s390x/
  35. target-sh4/
  36. target-sparc/
  37. target-unicore32/
  38. target-xtensa/
  39. tcg/
  40. tests/
  41. trace/
  42. ui/
  43. .exrc
  44. .gitignore
  45. .gitmodules
  46. .mailmap
  47. a.out.h
  48. acl.c
  49. acl.h
  50. aes.c
  51. aes.h
  52. aio.c
  53. alpha-dis.c
  54. alpha.ld
  55. arch_init.c
  56. arch_init.h
  57. arm-dis.c
  58. arm.ld
  59. async.c
  60. balloon.c
  61. balloon.h
  62. bitmap.c
  63. bitmap.h
  64. bitops.c
  65. bitops.h
  66. block-migration.c
  67. block-migration.h
  68. block.c
  69. block.h
  70. block_int.h
  71. blockdev.c
  72. blockdev.h
  73. blockjob.c
  74. blockjob.h
  75. bswap.h
  76. bt-host.c
  77. bt-host.h
  78. bt-vhci.c
  79. buffered_file.c
  80. buffered_file.h
  81. cache-utils.c
  82. cache-utils.h
  83. Changelog
  84. cmd.c
  85. cmd.h
  86. CODING_STYLE
  87. compatfd.c
  88. compatfd.h
  89. compiler.h
  90. config.h
  91. configure
  92. console.c
  93. console.h
  94. COPYING
  95. COPYING.LIB
  96. coroutine-gthread.c
  97. coroutine-sigaltstack.c
  98. coroutine-ucontext.c
  99. coroutine-win32.c
  100. cpu-all.h
  101. cpu-common.h
  102. cpu-defs.h
  103. cpu-exec.c
  104. cpus.c
  105. cpus.h
  106. cputlb.c
  107. cputlb.h
  108. cris-dis.c
  109. cursor.c
  110. cursor_hidden.xpm
  111. cursor_left_ptr.xpm
  112. cutils.c
  113. def-helper.h
  114. device_tree.c
  115. device_tree.h
  116. dis-asm.h
  117. disas.c
  118. disas.h
  119. dma-helpers.c
  120. dma.h
  121. dump-stub.c
  122. dump.c
  123. dump.h
  124. elf.h
  125. envlist.c
  126. envlist.h
  127. error.c
  128. error.h
  129. event_notifier.c
  130. event_notifier.h
  131. exec-all.h
  132. exec-memory.h
  133. exec-obsolete.h
  134. exec.c
  135. gdbstub.c
  136. gdbstub.h
  137. gen-icount.h
  138. HACKING
  139. hmp-commands.hx
  140. hmp.c
  141. hmp.h
  142. host-utils.c
  143. host-utils.h
  144. hppa-dis.c
  145. hppa.ld
  146. i386-dis.c
  147. i386.ld
  148. ia64-dis.c
  149. ia64.ld
  150. input.c
  151. int128.h
  152. iohandler.c
  153. ioport.c
  154. ioport.h
  155. iorange.h
  156. iov.c
  157. iov.h
  158. json-lexer.c
  159. json-lexer.h
  160. json-parser.c
  161. json-parser.h
  162. json-streamer.c
  163. json-streamer.h
  164. kvm-all.c
  165. kvm-stub.c
  166. kvm.h
  167. libfdt_env.h
  168. LICENSE
  169. linux-aio.c
  170. lm32-dis.c
  171. m68k-dis.c
  172. m68k.ld
  173. main-loop.c
  174. main-loop.h
  175. MAINTAINERS
  176. Makefile
  177. Makefile.dis
  178. Makefile.objs
  179. Makefile.target
  180. Makefile.user
  181. memory.c
  182. memory.h
  183. memory_mapping-stub.c
  184. memory_mapping.c
  185. memory_mapping.h
  186. microblaze-dis.c
  187. migration-exec.c
  188. migration-fd.c
  189. migration-tcp.c
  190. migration-unix.c
  191. migration.c
  192. migration.h
  193. mips-dis.c
  194. mips.ld
  195. module.c
  196. module.h
  197. monitor.c
  198. monitor.h
  199. nbd.c
  200. nbd.h
  201. net.c
  202. net.h
  203. notify.c
  204. notify.h
  205. os-posix.c
  206. os-win32.c
  207. osdep.c
  208. osdep.h
  209. oslib-posix.c
  210. oslib-win32.c
  211. page_cache.c
  212. path.c
  213. pci-ids.txt
  214. pflib.c
  215. pflib.h
  216. poison.h
  217. posix-aio-compat.c
  218. ppc-dis.c
  219. ppc.ld
  220. ppc64.ld
  221. qapi-schema-guest.json
  222. qapi-schema-test.json
  223. qapi-schema.json
  224. qbool.c
  225. qbool.h
  226. qdict-test-data.txt
  227. qdict.c
  228. qdict.h
  229. qemu-aio.h
  230. qemu-barrier.h
  231. qemu-bridge-helper.c
  232. qemu-char.c
  233. qemu-char.h
  234. qemu-common.h
  235. qemu-config.c
  236. qemu-config.h
  237. qemu-coroutine-int.h
  238. qemu-coroutine-io.c
  239. qemu-coroutine-lock.c
  240. qemu-coroutine-sleep.c
  241. qemu-coroutine.c
  242. qemu-coroutine.h
  243. qemu-doc.texi
  244. qemu-error.c
  245. qemu-error.h
  246. qemu-file.h
  247. qemu-ga.c
  248. qemu-img-cmds.hx
  249. qemu-img.c
  250. qemu-img.texi
  251. qemu-io.c
  252. qemu-lock.h
  253. qemu-log.c
  254. qemu-log.h
  255. qemu-nbd.c
  256. qemu-nbd.texi
  257. qemu-objects.h
  258. qemu-option-internal.h
  259. qemu-option.c
  260. qemu-option.h
  261. qemu-options-wrapper.h
  262. qemu-options.h
  263. qemu-options.hx
  264. qemu-os-posix.h
  265. qemu-os-win32.h
  266. qemu-progress.c
  267. qemu-queue.h
  268. qemu-seccomp.c
  269. qemu-seccomp.h
  270. qemu-sockets.c
  271. qemu-tech.texi
  272. qemu-thread-posix.c
  273. qemu-thread-posix.h
  274. qemu-thread-win32.c
  275. qemu-thread-win32.h
  276. qemu-thread.h
  277. qemu-timer-common.c
  278. qemu-timer.c
  279. qemu-timer.h
  280. qemu-tls.h
  281. qemu-tool.c
  282. qemu-user.c
  283. qemu-x509.h
  284. qemu-xattr.h
  285. qemu.sasl
  286. qemu_socket.h
  287. qerror.c
  288. qerror.h
  289. qfloat.c
  290. qfloat.h
  291. qint.c
  292. qint.h
  293. qjson.c
  294. qjson.h
  295. qlist.c
  296. qlist.h
  297. qmp-commands.hx
  298. qmp.c
  299. qobject.h
  300. qstring.c
  301. qstring.h
  302. qtest.c
  303. qtest.h
  304. range.h
  305. readline.c
  306. readline.h
  307. README
  308. rules.mak
  309. s390-dis.c
  310. s390.ld
  311. savevm.c
  312. sh4-dis.c
  313. softmmu-semi.h
  314. softmmu_defs.h
  315. softmmu_exec.h
  316. softmmu_header.h
  317. softmmu_template.h
  318. sparc-dis.c
  319. sparc.ld
  320. sparc64.ld
  321. spice-qemu-char.c
  322. sysemu.h
  323. targphys.h
  324. tcg-runtime.c
  325. tci-dis.c
  326. tci.c
  327. thunk.c
  328. thunk.h
  329. TODO
  330. trace-events
  331. translate-all.c
  332. uboot_image.h
  333. uri.c
  334. uri.h
  335. user-exec.c
  336. VERSION
  337. version.rc
  338. vgafont.h
  339. vl.c
  340. vmstate.h
  341. x86_64.ld
  342. xen-all.c
  343. xen-mapcache.c
  344. xen-mapcache.h
  345. xen-stub.c