Wed Jul 4 10:14:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>

* src/conf.c, src/test.c, src/xen_internal.c: Readd checking
          of errors from virBuffer functions.
        * src/sexpr.c: Add comment about use of _GNU_SOURCE.
        * src/virsh.c: Remove use of _GNU_SOURCE / isblank.
        * src/xml.c, tests/Makefile.am: Minor cleanup.
This commit is contained in:
Richard W.M. Jones 2007-07-04 09:16:23 +00:00
parent 483f6d6951
commit 9cd405497f
8 changed files with 26 additions and 17 deletions

View File

@ -1,3 +1,11 @@
Wed Jul 4 10:14:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
* src/conf.c, src/test.c, src/xen_internal.c: Readd checking
of errors from virBuffer functions.
* src/sexpr.c: Add comment about use of _GNU_SOURCE.
* src/virsh.c: Remove use of _GNU_SOURCE / isblank.
* src/xml.c, tests/Makefile.am: Minor cleanup.
Mon Jul 2 09:35:00 EST 2007 Daniel P. Berrange <berrange@redhat.com> Mon Jul 2 09:35:00 EST 2007 Daniel P. Berrange <berrange@redhat.com>
* src/qemu_driver.c: Change 'qemu' to 'QEMU' to get compatability * src/qemu_driver.c: Change 'qemu' to 'QEMU' to get compatability

View File

@ -883,8 +883,10 @@ __virConfWriteFile(const char *filename, virConfPtr conf)
return(-1); return(-1);
buf = virBufferNew(500); buf = virBufferNew(500);
if (buf == NULL) if (buf == NULL) {
virConfError(NULL, VIR_ERR_NO_MEMORY, _("failed to allocate buffer"), 0);
return(-1); return(-1);
}
cur = conf->entries; cur = conf->entries;
while (cur != NULL) { while (cur != NULL) {
@ -935,8 +937,10 @@ __virConfWriteMem(char *memory, int *len, virConfPtr conf)
return(-1); return(-1);
buf = virBufferNew(500); buf = virBufferNew(500);
if (buf == NULL) if (buf == NULL) {
virConfError(NULL, VIR_ERR_NO_MEMORY, _("failed to allocate buffer"), 0);
return(-1); return(-1);
}
cur = conf->entries; cur = conf->entries;
while (cur != NULL) { while (cur != NULL) {

View File

@ -10,7 +10,7 @@
* archive for more details. * archive for more details.
*/ */
#define _GNU_SOURCE #define _GNU_SOURCE /* for strndup */
#include "sexpr.h" #include "sexpr.h"
#include "internal.h" #include "internal.h"

View File

@ -1389,6 +1389,7 @@ char * testDomainDumpXML(virDomainPtr domain, int flags ATTRIBUTE_UNUSED)
con = &node->connections[priv->handle]; con = &node->connections[priv->handle];
if (!(buf = virBufferNew(4000))) { if (!(buf = virBufferNew(4000))) {
testError(domain->conn, domain, VIR_ERR_NO_MEMORY, __FUNCTION__);
return (NULL); return (NULL);
} }

View File

@ -13,8 +13,6 @@
* $Id$ * $Id$
*/ */
#define _GNU_SOURCE /* isblank() */
#include "libvirt/libvirt.h" #include "libvirt/libvirt.h"
#include "libvirt/virterror.h" #include "libvirt/virterror.h"
#include <stdio.h> #include <stdio.h>
@ -3806,7 +3804,7 @@ vshCommandGetToken(vshControl * ctl, char *str, char **end, char **res)
*end = NULL; *end = NULL;
while (p && *p && isblank((unsigned char) *p)) while (p && *p && (*p == ' ' || *p == '\t'))
p++; p++;
if (p == NULL || *p == '\0') if (p == NULL || *p == '\0')
@ -3817,7 +3815,7 @@ vshCommandGetToken(vshControl * ctl, char *str, char **end, char **res)
} }
while (*p) { while (*p) {
/* end of token is blank space or ';' */ /* end of token is blank space or ';' */
if ((quote == FALSE && isblank((unsigned char) *p)) || *p == ';') if ((quote == FALSE && (*p == ' ' || *p == '\t')) || *p == ';')
break; break;
/* end of option name could be '=' */ /* end of option name could be '=' */

View File

@ -2138,7 +2138,10 @@ xenHypervisorMakeCapabilitiesXML(virConnectPtr conn ATTRIBUTE_UNUSED,
/* Construct the final XML. */ /* Construct the final XML. */
xml = virBufferNew (1024); xml = virBufferNew (1024);
if (!xml) return NULL; if (!xml) {
virXenError(VIR_ERR_NO_MEMORY, __FUNCTION__, 0);
return NULL;
}
r = virBufferVSprintf (xml, r = virBufferVSprintf (xml,
"\ "\
<capabilities>\n\ <capabilities>\n\
@ -2225,15 +2228,13 @@ xenHypervisorMakeCapabilitiesXML(virConnectPtr conn ATTRIBUTE_UNUSED,
</capabilities>\n", -1); </capabilities>\n", -1);
if (r == -1) goto vir_buffer_failed; if (r == -1) goto vir_buffer_failed;
xml_str = strdup (xml->content); xml_str = strdup (xml->content);
if (!xml_str) { if (!xml_str) goto vir_buffer_failed;
virXenError(VIR_ERR_NO_MEMORY, "strdup", 0);
goto vir_buffer_failed;
}
virBufferFree (xml); virBufferFree (xml);
return xml_str; return xml_str;
vir_buffer_failed: vir_buffer_failed:
virXenError(VIR_ERR_NO_MEMORY, __FUNCTION__, 0);
virBufferFree (xml); virBufferFree (xml);
return NULL; return NULL;
} }

View File

@ -267,10 +267,7 @@ virXPathNodeSet(const char *xpath, xmlXPathContextPtr ctxt, xmlNodePtr **list) {
xmlXPathFreeObject(obj); xmlXPathFreeObject(obj);
return(ret); return(ret);
} }
#endif /* !PROXY */
#ifndef PROXY
/** /**
* virtDomainParseXMLGraphicsDescImage: * virtDomainParseXMLGraphicsDescImage:
* @conn: pointer to the hypervisor connection * @conn: pointer to the hypervisor connection

View File

@ -46,8 +46,8 @@ valgrind:
xmlrpctest_SOURCES = \ xmlrpctest_SOURCES = \
xmlrpctest.c \ xmlrpctest.c \
testutils.c testutils.h \ testutils.c testutils.h \
$(top_builddir)/src/xmlrpc.c \ @top_srcdir@/src/xmlrpc.c \
$(top_builddir)/src/xmlrpc.h @top_srcdir@/src/xmlrpc.h
xmlrpctest_LDFLAGS = xmlrpctest_LDFLAGS =
xmlrpctest_LDADD = $(LDADDS) xmlrpctest_LDADD = $(LDADDS)