[Libvir] [PATCH] Detect heap allocation failure; factor out some duplication.

Daniel P. Berrange berrange at redhat.com
Wed Dec 5 18:59:04 UTC 2007


Just discovered an accidental ommission in this patch - removed the listen_tls 
and listen_tcp config param handling completely. So I've commited the attached
trivial patch to re-add them.


On Thu, Nov 29, 2007 at 07:35:47PM +0100, Jim Meyering wrote:
> @@ -1521,166 +1654,103 @@ remoteReadConfigFile (const char *filename)
>      conf = virConfReadFile (filename);
>      if (!conf) return 0;
>  
> -    virConfValuePtr p;
> -
> -#define CHECK_TYPE(name,typ) if (p && p->type != (typ)) {               \
> -        qemudLog (QEMUD_ERR,                                            \
> -                  "remoteReadConfigFile: %s: %s: expected type " #typ "\n", \
> -                  filename, (name));                                    \
> -        return -1;                                                      \
> -    }
> -
> -    p = virConfGetValue (conf, "listen_tls");
> -    CHECK_TYPE ("listen_tls", VIR_CONF_LONG);
> -    listen_tls = p ? p->l : listen_tls;
> -
> -    p = virConfGetValue (conf, "listen_tcp");
> -    CHECK_TYPE ("listen_tcp", VIR_CONF_LONG);
> -    listen_tcp = p ? p->l : listen_tcp;
> -
> -    p = virConfGetValue (conf, "tls_port");
> -    CHECK_TYPE ("tls_port", VIR_CONF_STRING);
> -    tls_port = p ? strdup (p->str) : tls_port;
> -
> -    p = virConfGetValue (conf, "tcp_port");
> -    CHECK_TYPE ("tcp_port", VIR_CONF_STRING);
> -    tcp_port = p ? strdup (p->str) : tcp_port;
> +    GET_CONF_STR (conf, filename, tls_port);
> +    GET_CONF_STR (conf, filename, tcp_port);
>  

Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 
-------------- next part --------------
diff -r 2c0db70fad23 qemud/qemud.c
--- a/qemud/qemud.c	Wed Dec 05 13:29:48 2007 -0500
+++ b/qemud/qemud.c	Wed Dec 05 13:47:02 2007 -0500
@@ -1839,6 +1839,8 @@ remoteReadConfigFile (struct qemud_serve
     conf = virConfReadFile (filename);
     if (!conf) return 0;
 
+    GET_CONF_INT (conf, filename, listen_tcp);
+    GET_CONF_INT (conf, filename, listen_tls);
     GET_CONF_STR (conf, filename, tls_port);
     GET_CONF_STR (conf, filename, tcp_port);
 


More information about the libvir-list mailing list