1
1
Description: autodetect if the remote nc command supports the -q option
2
2
Author: Marc Deslauriers <marc.deslauriers@ubuntu.com>
3
3
Origin: other, based on http://hg.fedorahosted.org/hg/virt-manager/rev/1f781890ea4a
4
Origin: other, based on http://hg.fedorahosted.org/hg/virt-manager/rev/f09702cfdb03
5
Origin: other, based on http://hg.fedorahosted.org/hg/virt-manager/rev/907ee61e5558
6
Origin: other, based on http://hg.fedorahosted.org/hg/virt-manager/rev/16fcbf77e47e
4
7
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/517478
8
Ubuntu-Bug: https://bugs.launchpad.net/ubuntu/+source/virt-manager/+bug/605172
5
9
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=562176
10
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=614420
7
12
Index: libvirt-0.8.3/src/remote/remote_driver.c
8
13
===================================================================
9
--- libvirt-0.8.3.orig/src/remote/remote_driver.c 2010-08-11 16:32:56.000000000 -0500
10
+++ libvirt-0.8.3/src/remote/remote_driver.c 2010-08-11 17:12:01.000000000 -0500
14
--- libvirt-0.8.3.orig/src/remote/remote_driver.c 2010-08-25 12:32:54.000000000 -0400
15
+++ libvirt-0.8.3/src/remote/remote_driver.c 2010-08-25 12:39:59.000000000 -0400
11
16
@@ -730,7 +730,8 @@
15
20
- int j, nr_args = 6;
17
22
+ virBuffer cmd_netcat = VIR_BUFFER_INITIALIZER;
19
24
if (username) nr_args += 2; /* For -l username */
20
25
if (no_tty) nr_args += 5; /* For -T -o BatchMode=yes -e none */
22
27
cmd_argv[j++] = strdup ("none");
24
29
cmd_argv[j++] = strdup (priv->hostname);
28
33
- (flags & VIR_CONNECT_RO
29
34
- ? LIBVIRTD_PRIV_UNIX_SOCKET_RO
30
35
- : LIBVIRTD_PRIV_UNIX_SOCKET));
36
+ cmd_argv[j++] = strdup ("sh -c");
33
39
+ * This ugly thing is a shell script to detect availability of
40
46
+ * to the desired behavior.
43
+ virBufferVSprintf(&cmd_netcat, "%s -q 2>&1 | grep -q 'requires an argument';"
49
+ virBufferVSprintf(&cmd_netcat, "'%s -q 2>&1 | grep -q \"requires an argument\";"
44
50
+ "if [ $? -eq 0 ] ; then"
51
+ " CMD=\"%s -q 0 -U %s\";"
49
+ netcat ? netcat : "nc",
53
+ " CMD=\"%s -U %s\";"
56
+ netcat ? netcat : "nc",
57
+ netcat ? netcat : "nc",
58
+ sockname ? sockname :
59
+ (flags & VIR_CONNECT_RO
60
+ ? LIBVIRTD_PRIV_UNIX_SOCKET_RO
61
+ : LIBVIRTD_PRIV_UNIX_SOCKET),
50
62
+ netcat ? netcat : "nc",
51
63
+ sockname ? sockname :
52
64
+ (flags & VIR_CONNECT_RO