resolves: RHEL-81733 Fix virt-v2v conversion of split /usr Ubuntu 22+ resolves: RHEL-87622 Remove dependencies on oUnit, flex, bison
45 lines
1.6 KiB
Diff
45 lines
1.6 KiB
Diff
From bcd6b3ec3a1038d840e832732b3910f939566436 Mon Sep 17 00:00:00 2001
|
|
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
Date: Wed, 16 Apr 2025 13:19:17 +0100
|
|
Subject: [PATCH] generator: Fix implementation of FUUID for OCaml functions
|
|
|
|
This was implemented wrongly. In the XDR protocol, UUIDs are fixed
|
|
buffers of length 32. We can just use memcpy to copy from the OCaml
|
|
string to the UUID, but we have to ensure the string length returned
|
|
by OCaml is correct (if not we just assert, it's an internal error).
|
|
|
|
(It didn't even compile before, so we know it was never used).
|
|
---
|
|
generator/daemon.ml | 6 +++++-
|
|
1 file changed, 5 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/generator/daemon.ml b/generator/daemon.ml
|
|
index e19fa07d2..b23034fd7 100644
|
|
--- a/generator/daemon.ml
|
|
+++ b/generator/daemon.ml
|
|
@@ -606,6 +606,7 @@ let generate_daemon_caml_stubs () =
|
|
#include <string.h>
|
|
#include <inttypes.h>
|
|
#include <errno.h>
|
|
+#include <assert.h>
|
|
|
|
#include <caml/alloc.h>
|
|
#include <caml/callback.h>
|
|
@@ -641,9 +642,12 @@ let generate_daemon_caml_stubs () =
|
|
fun i ->
|
|
pr " v = Field (retv, %d);\n" i;
|
|
function
|
|
- | n, (FString|FDevice|FUUID) ->
|
|
+ | n, (FString|FDevice) ->
|
|
pr " ret->%s = strdup (String_val (v));\n" n;
|
|
pr " if (ret->%s == NULL) return NULL;\n" n
|
|
+ | n, FUUID ->
|
|
+ pr " assert (caml_string_length (v) == sizeof ret->%s);\n" n;
|
|
+ pr " memcpy (ret->%s, String_val (v), sizeof ret->%s);\n" n n
|
|
| n, FBuffer ->
|
|
pr " ret->%s_len = caml_string_length (v);\n" n;
|
|
pr " ret->%s = strdup (String_val (v));\n" n;
|
|
--
|
|
2.47.1
|
|
|