[virt-tools-list] [PATCH virt-viewer] Use socat instead of nc if possible
Eric Blake
eblake at redhat.com
Wed Sep 3 15:24:03 UTC 2014
On 09/03/2014 07:39 AM, Cole Robinson wrote:
> I'd really recommend that virt-viewer just use the same shell code that
> libvirt and virt-manager have used for years now, it's a crazy hack but it
> should be battle hardened by now.
>
For reference, it is in
src/rpc/virnetsocket.c:virNetSocketNewConnectSSH(), as:
virBufferEscapeShell(&buf, netcat);
if (virBufferCheckError(&buf) < 0) {
virCommandFree(cmd);
return -1;
}
quoted = virBufferContentAndReset(&buf);
/*
* This ugly thing is a shell script to detect availability of
* the -q option for 'nc': debian and suse based distros need this
* flag to ensure the remote nc will exit on EOF, so it will go away
* when we close the connection tunnel. If it doesn't go away,
subsequent
* connection attempts will hang.
*
* Fedora's 'nc' doesn't have this option, and defaults to the desired
* behavior.
*/
virCommandAddArgFormat(cmd,
"'if '%s' -q 2>&1 | grep \"requires an argument\" >/dev/null
2>&1; then "
"ARG=-q0;"
"else "
"ARG=;"
"fi;"
"'%s' $ARG -U %s'",
quoted, quoted, path);
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 539 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20140903/4038db8f/attachment.sig>
More information about the virt-tools-list
mailing list