[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] Patch is faulty



Sorry, this patch is wrong. I forgot to re-run git format-patch
after discovering some bugs. Please ignore.

/Jonas

On Wed, Aug 05, 2009 at 12:53:44PM +0200 Jonas Eriksson wrote:
> Some netcat implementations does not support unix domain sockets (-U).
> Distros that ship these implementations often also ships socat, that
> do support this.
> 
> This is a reworked patch based on the openSUSE libvirt package. The
> original patch may be found in this source rpm:
> http://download.opensuse.org/source/distribution/11.1/repo/oss/suse/src/libvirt-0.4.6-11.1.src.rpm
> 
> * configure.in: Check for --with-socat and set USE_SOCAT in config.h
> 
> * src/remote_internal.c: Honour USE_SOCAT by selecting between
>   netcat/nc and socat at compile time.
> ---
>  configure.in          |    7 +++++++
>  src/remote_internal.c |   13 +++++++++++++
>  2 files changed, 20 insertions(+), 0 deletions(-)
> 
> diff --git a/configure.in b/configure.in
> index b905b23..732ef68 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -153,6 +153,13 @@ if test -n "$MODPROBE"; then
>          [Location or name of the modprobe program])
>  fi
>  
> +dnl Check if socat should be used instead of netcat
> +AC_ARG_WITH([socat],
> +[  --with-socat            use socat instead of netcat (off)])
> +if test "$with_socat" = "yes" ; then
> +  AC_DEFINE_UNQUOTED([USE_SOCAT], 1, [whether socat should be used instead of netcat])
> +fi
> +
>  dnl Specific dir for HTML output ?
>  AC_ARG_WITH([html-dir], [AC_HELP_STRING([--with-html-dir=path],
>              [path to base html directory, default $datadir/doc/html])],
> diff --git a/src/remote_internal.c b/src/remote_internal.c
> index a58b768..7678317 100644
> --- a/src/remote_internal.c
> +++ b/src/remote_internal.c
> @@ -725,6 +725,18 @@ doRemoteOpen (virConnectPtr conn,
>              cmd_argv[j++] = strdup ("-e");
>              cmd_argv[j++] = strdup ("none");
>          }
> +#ifdef USE_SOCAT
> +        cmd_argv[j++] = strdup ("socat");
> +        cmd_argv[j++] = strdup ("-");
> +
> +        char *socat_addr = 0;
> +        if ((asprintf (&socat_addr, "GOPEN:%s",
> +                sockname ? sockname : LIBVIRTD_PRIV_UNIX_SOCKET)) < 0) {
> +            error (conn, VIR_ERR_SYSTEM_ERROR, strerror (ENOMEM));
> +            goto failed;
> +        }
> +        cmd_argv[j++] = socat_addr;
> +#else
>          cmd_argv[j++] = strdup (priv->hostname);
>          cmd_argv[j++] = strdup (netcat ? netcat : "nc");
>          cmd_argv[j++] = strdup ("-U");
> @@ -732,6 +744,7 @@ doRemoteOpen (virConnectPtr conn,
>                                  (flags & VIR_CONNECT_RO
>                                   ? LIBVIRTD_PRIV_UNIX_SOCKET_RO
>                                   : LIBVIRTD_PRIV_UNIX_SOCKET));
> +#endif
>          cmd_argv[j++] = 0;
>          assert (j == nr_args);
>          for (j = 0; j < (nr_args-1); j++)
> -- 
> 1.6.2
> 


--
Jonas Eriksson
Consultant at AS/EAB/FLJ/IL
Combitech AB
Älvsjö, Sweden


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]