Use the safer mkdtemp instead of manually creating a path.
---
sysprep/Makefile.am | 2 ++
sysprep/sysprep_operation_script.ml | 4 +---
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/sysprep/Makefile.am b/sysprep/Makefile.am
index 2600477..9c9ab14 100644
--- a/sysprep/Makefile.am
+++ b/sysprep/Makefile.am
@@ -100,6 +100,8 @@ OBJECTS = \
$(top_builddir)/mllib/timezone.cmx \
$(top_builddir)/mllib/firstboot.cmx \
$(top_builddir)/mllib/config.cmx \
+ $(top_builddir)/mllib/mkdtemp-c.o \
+ $(top_builddir)/mllib/mkdtemp.cmx \
sysprep_operation.cmx \
$(patsubst %,sysprep_operation_%.cmx,$(operations)) \
main.cmx
diff --git a/sysprep/sysprep_operation_script.ml b/sysprep/sysprep_operation_script.ml
index 518207e..614910f 100644
--- a/sysprep/sysprep_operation_script.ml
+++ b/sysprep/sysprep_operation_script.ml
@@ -44,9 +44,7 @@ let rec script_perform (g : Guestfs.guestfs) root side_effects =
match !scriptdir with
| Some dir -> dir, false
| None ->
- let tmpdir = Filename.temp_dir_name in
- let tmpdir = tmpdir // string_random8 () in
- mkdir tmpdir 0o755;
+ let tmpdir = Mkdtemp.mkdtemp (Filename.temp_dir_name //
"virt-sysprep.XXXXXX") in
tmpdir, true in
(* Mount the directory locally. *)
--
1.8.3.1