From 1a1f8b9dbb68bf43c831e471ab4308d81a113ecd Mon Sep 17 00:00:00 2001 From: Jim Fehlig 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;