libvirt/sexpr2string.patch
OBS User autobuild 2d4a8769c2 Accepting request 19439 from Virtualization
Copy from Virtualization/libvirt based on submit request 19439 from user jfehlig

OBS-URL: https://build.opensuse.org/request/show/19439
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libvirt?expand=0&rev=40
2009-09-02 16:42:33 +00:00

28 lines
974 B
Diff

From 1a1f8b9dbb68bf43c831e471ab4308d81a113ecd Mon Sep 17 00:00:00 2001
From: Jim Fehlig <jfehlig@novell.com>
Date: Tue, 25 Aug 2009 15:54:18 -0600
Subject: [PATCH] Fix sexpr2string() to handle empty list.
S-expression containing empty lists, e.g. (cpus (() () () ())),
was not being handled properly in sexpr2string() serialization.
Emit an empty list when encountering NIL sexpr kind.
---
src/sexpr.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
Index: libvirt-0.7.0/src/sexpr.c
===================================================================
--- libvirt-0.7.0.orig/src/sexpr.c
+++ libvirt-0.7.0/src/sexpr.c
@@ -255,6 +255,10 @@ sexpr2string(const struct sexpr * sexpr,
ret += tmp;
break;
case SEXPR_NIL:
+ tmp = snprintf(buffer + ret, n_buffer - ret, "()");
+ if (tmp == 0)
+ goto error;
+ ret += tmp;
break;
default:
goto error;