The C function mkdtemp(3) requires that the string ends with 6 'X'
characters, so appending a non-empty suffix causes the function to
raise EINVAL.
Luckily we only ever called this function with the last parameter "".
---
builder/builder.ml | 2 +-
builder/sigchecker.ml | 2 +-
common/mlutils/unix_utils.ml | 4 ++--
common/mlutils/unix_utils.mli | 4 ++--
dib/dib.ml | 2 +-
sysprep/sysprep_operation_script.ml | 2 +-
v2v/input_ova.ml | 2 +-
v2v/output_glance.ml | 2 +-
v2v/output_null.ml | 2 +-
v2v/output_rhv.ml | 2 +-
10 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/builder/builder.ml b/builder/builder.ml
index 0e02bab3b..3c1f04c77 100644
--- a/builder/builder.ml
+++ b/builder/builder.ml
@@ -181,7 +181,7 @@ let main () =
* temporary files that Downloader, Sigchecker, etc, are going
* create.
*)
- let tmpdir = Mkdtemp.temp_dir "virt-builder." "" in
+ let tmpdir = Mkdtemp.temp_dir "virt-builder." in
rmdir_on_exit tmpdir;
(* Download the sources. *)
diff --git a/builder/sigchecker.ml b/builder/sigchecker.ml
index f72c21ab0..55e743940 100644
--- a/builder/sigchecker.ml
+++ b/builder/sigchecker.ml
@@ -92,7 +92,7 @@ let import_keyfile ~gpg ~gpghome ~tmpdir ?(trust = true) keyfile =
let rec create ~gpg ~gpgkey ~check_signature ~tmpdir =
(* Create a temporary directory for gnupg. *)
- let gpgtmpdir = Mkdtemp.temp_dir ~base_dir:tmpdir "vb.gpghome." ""
in
+ let gpgtmpdir = Mkdtemp.temp_dir ~base_dir:tmpdir "vb.gpghome." in
(* Make sure we have no check_signature=true with no actual key. *)
let check_signature, gpgkey =
match check_signature, gpgkey with
diff --git a/common/mlutils/unix_utils.ml b/common/mlutils/unix_utils.ml
index 8ac36836c..b135bcaee 100644
--- a/common/mlutils/unix_utils.ml
+++ b/common/mlutils/unix_utils.ml
@@ -52,8 +52,8 @@ end
module Mkdtemp = struct
external mkdtemp : string -> string = "guestfs_int_mllib_mkdtemp"
- let temp_dir ?(base_dir = Filename.temp_dir_name) prefix suffix =
- mkdtemp (Filename.concat base_dir (prefix ^ "XXXXXX" ^ suffix))
+ let temp_dir ?(base_dir = Filename.temp_dir_name) prefix =
+ mkdtemp (Filename.concat base_dir (prefix ^ "XXXXXX"))
end
module Realpath = struct
diff --git a/common/mlutils/unix_utils.mli b/common/mlutils/unix_utils.mli
index 4795cb37f..f4f8ca578 100644
--- a/common/mlutils/unix_utils.mli
+++ b/common/mlutils/unix_utils.mli
@@ -80,8 +80,8 @@ module Mkdtemp : sig
val mkdtemp : string -> string
(** [mkdtemp pattern] Tiny wrapper to the C [mkdtemp]. *)
- val temp_dir : ?base_dir:string -> string -> string -> string
- (** [temp_dir prefix suffix] creates a new unique temporary directory.
+ val temp_dir : ?base_dir:string -> string -> string
+ (** [temp_dir prefix] creates a new unique temporary directory.
The optional [~base_dir:string] changes the base directory where
to create the new temporary directory; if not specified, the default
diff --git a/dib/dib.ml b/dib/dib.ml
index d083eed9f..e59ff94a8 100644
--- a/dib/dib.ml
+++ b/dib/dib.ml
@@ -548,7 +548,7 @@ let main () =
let image_basename = Filename.basename cmdline.image_name in
let image_basename_d = image_basename ^ ".d" in
- let tmpdir = Mkdtemp.temp_dir "dib." "" in
+ let tmpdir = Mkdtemp.temp_dir "dib." in
rmdir_on_exit tmpdir;
let auxtmpdir = tmpdir // "in_target.aux" in
do_mkdir auxtmpdir;
diff --git a/sysprep/sysprep_operation_script.ml b/sysprep/sysprep_operation_script.ml
index cf911043a..62a4a2d02 100644
--- a/sysprep/sysprep_operation_script.ml
+++ b/sysprep/sysprep_operation_script.ml
@@ -46,7 +46,7 @@ let rec script_perform (g : Guestfs.guestfs) root side_effects =
match !scriptdir with
| Some dir -> dir, false
| None ->
- let tmpdir = Mkdtemp.temp_dir "virt-sysprep." "" in
+ let tmpdir = Mkdtemp.temp_dir "virt-sysprep." in
tmpdir, true in
(* Mount the directory locally. *)
diff --git a/v2v/input_ova.ml b/v2v/input_ova.ml
index e8be68ed7..9ec991ba7 100644
--- a/v2v/input_ova.ml
+++ b/v2v/input_ova.ml
@@ -128,7 +128,7 @@ let find_files dir ext =
class input_ova ova =
let tmpdir =
let base_dir = (open_guestfs ())#get_cachedir () in
- let t = Mkdtemp.temp_dir ~base_dir "ova." "" in
+ let t = Mkdtemp.temp_dir ~base_dir "ova." in
rmdir_on_exit t;
t in
object
diff --git a/v2v/output_glance.ml b/v2v/output_glance.ml
index e26bc0732..a9d267e28 100644
--- a/v2v/output_glance.ml
+++ b/v2v/output_glance.ml
@@ -34,7 +34,7 @@ class output_glance () =
*)
let tmpdir =
let base_dir = (open_guestfs ())#get_cachedir () in
- let t = Mkdtemp.temp_dir ~base_dir "glance." "" in
+ let t = Mkdtemp.temp_dir ~base_dir "glance." in
rmdir_on_exit t;
t in
object
diff --git a/v2v/output_null.ml b/v2v/output_null.ml
index 9b31c2d00..e2302fc47 100644
--- a/v2v/output_null.ml
+++ b/v2v/output_null.ml
@@ -33,7 +33,7 @@ class output_null =
*)
let tmpdir =
let base_dir = (open_guestfs ())#get_cachedir () in
- let t = Mkdtemp.temp_dir ~base_dir "null." "" in
+ let t = Mkdtemp.temp_dir ~base_dir "null." in
rmdir_on_exit t;
t in
object
diff --git a/v2v/output_rhv.ml b/v2v/output_rhv.ml
index 0c02df612..f1a193bde 100644
--- a/v2v/output_rhv.ml
+++ b/v2v/output_rhv.ml
@@ -40,7 +40,7 @@ let rec mount_and_check_storage_domain domain_class os =
(* Create a mountpoint. Default mode is too restrictive for us
* when we need to write into the directory as 36:36.
*)
- let mp = Mkdtemp.temp_dir "v2v." "" in
+ let mp = Mkdtemp.temp_dir "v2v." in
chmod mp 0o755;
(* Try mounting it. *)
--
2.13.2