mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-09-13 11:15:08 +00:00
* src/buf.c: applied patch from Masayuki Sunou fixing a loop
due to an error in growing buffers. Daniel
This commit is contained in:
parent
b001650c7d
commit
3c999f7ff4
@ -1,3 +1,8 @@
|
|||||||
|
Thu Aug 30 15:11:44 CEST 2007 Daniel Veillard <veillard@redhat.com>
|
||||||
|
|
||||||
|
* src/buf.c: applied patch from Masayuki Sunou fixing a loop
|
||||||
|
due to an error in growing buffers.
|
||||||
|
|
||||||
Wed Aug 29 14:43:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
|
Wed Aug 29 14:43:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
|
||||||
|
|
||||||
* src/xen_internal.c (xenHypervisorDomainInterfaceStats): Swap
|
* src/xen_internal.c (xenHypervisorDomainInterfaceStats): Swap
|
||||||
|
10
src/buf.c
10
src/buf.c
@ -159,7 +159,7 @@ virBufferContentAndFree (virBufferPtr buf)
|
|||||||
int
|
int
|
||||||
virBufferVSprintf(virBufferPtr buf, const char *format, ...)
|
virBufferVSprintf(virBufferPtr buf, const char *format, ...)
|
||||||
{
|
{
|
||||||
int size, count;
|
int size, count, grow_size;
|
||||||
va_list locarg, argptr;
|
va_list locarg, argptr;
|
||||||
|
|
||||||
if ((format == NULL) || (buf == NULL)) {
|
if ((format == NULL) || (buf == NULL)) {
|
||||||
@ -172,7 +172,8 @@ virBufferVSprintf(virBufferPtr buf, const char *format, ...)
|
|||||||
locarg)) < 0) || (count >= size - 1)) {
|
locarg)) < 0) || (count >= size - 1)) {
|
||||||
buf->content[buf->use] = 0;
|
buf->content[buf->use] = 0;
|
||||||
va_end(locarg);
|
va_end(locarg);
|
||||||
if (virBufferGrow(buf, 1000) < 0) {
|
grow_size = (count > 1000) ? count : 1000;
|
||||||
|
if (virBufferGrow(buf, grow_size) < 0) {
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
size = buf->size - buf->use - 1;
|
size = buf->size - buf->use - 1;
|
||||||
@ -198,7 +199,7 @@ virBufferVSprintf(virBufferPtr buf, const char *format, ...)
|
|||||||
int
|
int
|
||||||
virBufferEscapeString(virBufferPtr buf, const char *format, const char *str)
|
virBufferEscapeString(virBufferPtr buf, const char *format, const char *str)
|
||||||
{
|
{
|
||||||
int size, count, len;
|
int size, count, len, grow_size;
|
||||||
char *escaped, *out;
|
char *escaped, *out;
|
||||||
const char *cur;
|
const char *cur;
|
||||||
|
|
||||||
@ -248,7 +249,8 @@ virBufferEscapeString(virBufferPtr buf, const char *format, const char *str)
|
|||||||
while (((count = snprintf(&buf->content[buf->use], size, format,
|
while (((count = snprintf(&buf->content[buf->use], size, format,
|
||||||
(char *)escaped)) < 0) || (count >= size - 1)) {
|
(char *)escaped)) < 0) || (count >= size - 1)) {
|
||||||
buf->content[buf->use] = 0;
|
buf->content[buf->use] = 0;
|
||||||
if (virBufferGrow(buf, 1000) < 0) {
|
grow_size = (count > 1000) ? count : 1000;
|
||||||
|
if (virBufferGrow(buf, grow_size) < 0) {
|
||||||
free(escaped);
|
free(escaped);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user