From cb83441a2e80b7e57ea0010ca010ea939b416506 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 1 Jan 1970 00:00:00 +0000 Subject: [PATCH] Return UUID (packed byte array) correctly. --- libvirt/generator.pl | 6 +- libvirt/libvirt_c.c | 206 ++++++++++++++++++++++++++------------------------- 2 files changed, 110 insertions(+), 102 deletions(-) diff --git a/libvirt/generator.pl b/libvirt/generator.pl index ad2069f..0a73264 100755 --- a/libvirt/generator.pl +++ b/libvirt/generator.pl @@ -562,7 +562,9 @@ sub gen_c_code NONBLOCKING (r = $c_name ($1, uuid)); CHECK_ERROR (r == -1, conn, \"$c_name\"); - rv = caml_copy_string ((char *) uuid); + /* UUIDs are byte arrays with a fixed length. */ + rv = caml_alloc_string (VIR_UUID_BUFLEN); + memcpy (String_val (rv), uuid, VIR_UUID_BUFLEN); CAMLreturn (rv); " } elsif ($sig =~ /^(\w+) : uuid string$/) { @@ -886,7 +888,7 @@ foreach my $function (@functions) { print F <