[Pkg-libvirt-commits] [libguestfs] 22/54: sysprep: use Mkdtemp to create the temporary directory
Hilko Bengen
bengen at moszumanska.debian.org
Sun Mar 9 11:21:15 UTC 2014
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to branch debian
in repository libguestfs.
commit f3c0105b607379e852885d4c29f6c8d98960d4fd
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.
(cherry picked from commit 0f3898b2f5587c9cdd9b26d51dac44b5c3f36055)
---
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 24654cb..60572fe 100644
--- a/sysprep/Makefile.am
+++ b/sysprep/Makefile.am
@@ -95,6 +95,8 @@ OBJECTS = \
$(top_builddir)/mllib/hostname.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 60586d4..239e12a 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 =
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