[Pkg-libvirt-commits] [libguestfs] 03/26: sysprep: use Mkdtemp to create the temporary directory
Hilko Bengen
bengen at moszumanska.debian.org
Sun Mar 2 13:37:35 UTC 2014
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to annotated tag upstream/1.25.39
in repository libguestfs.
commit 0f3898b2f5587c9cdd9b26d51dac44b5c3f36055
Author: Pino Toscano <ptoscano at redhat.com>
Date: Mon Feb 24 15:40:29 2014 +0100
sysprep: use Mkdtemp to create the temporary directory
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. *)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git
More information about the Pkg-libvirt-commits
mailing list