summaryrefslogtreecommitdiffstats
path: root/ocaml/guestfs_c_actions.c
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2009-06-24 18:25:09 +0100
committerRichard W.M. Jones <rjones@redhat.com>2009-06-24 18:25:09 +0100
commit0574eab8bc7d8e72db862ec36815835938a5fdf1 (patch)
tree6588315e33f95de9fbb150f862064471a975050e /ocaml/guestfs_c_actions.c
parent8228eec99045ae720d8ef35851aa8c278f6b4e5c (diff)
downloadlibguestfs-0574eab8bc7d8e72db862ec36815835938a5fdf1.tar.gz
libguestfs-0574eab8bc7d8e72db862ec36815835938a5fdf1.tar.xz
libguestfs-0574eab8bc7d8e72db862ec36815835938a5fdf1.zip
Generated code for 'mkdtemp' command.
Diffstat (limited to 'ocaml/guestfs_c_actions.c')
-rw-r--r--ocaml/guestfs_c_actions.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/ocaml/guestfs_c_actions.c b/ocaml/guestfs_c_actions.c
index a8204e8a..f4079564 100644
--- a/ocaml/guestfs_c_actions.c
+++ b/ocaml/guestfs_c_actions.c
@@ -4343,3 +4343,27 @@ ocaml_guestfs_scrub_freespace (value gv, value dirv)
CAMLreturn (rv);
}
+CAMLprim value
+ocaml_guestfs_mkdtemp (value gv, value templatev)
+{
+ CAMLparam2 (gv, templatev);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("mkdtemp: used handle after closing it");
+
+ const char *template = String_val (templatev);
+ char *r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_mkdtemp (g, template);
+ caml_leave_blocking_section ();
+ if (r == NULL)
+ ocaml_guestfs_raise_error (g, "mkdtemp");
+
+ rv = caml_copy_string (r);
+ free (r);
+ CAMLreturn (rv);
+}
+