diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2009-06-24 18:25:09 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2009-06-24 18:25:09 +0100 |
commit | 0574eab8bc7d8e72db862ec36815835938a5fdf1 (patch) | |
tree | 6588315e33f95de9fbb150f862064471a975050e /ruby | |
parent | 8228eec99045ae720d8ef35851aa8c278f6b4e5c (diff) | |
download | libguestfs-0574eab8bc7d8e72db862ec36815835938a5fdf1.tar.gz libguestfs-0574eab8bc7d8e72db862ec36815835938a5fdf1.tar.xz libguestfs-0574eab8bc7d8e72db862ec36815835938a5fdf1.zip |
Generated code for 'mkdtemp' command.
Diffstat (limited to 'ruby')
-rw-r--r-- | ruby/ext/guestfs/_guestfs.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/ruby/ext/guestfs/_guestfs.c b/ruby/ext/guestfs/_guestfs.c index ba9de13e..5eb892ff 100644 --- a/ruby/ext/guestfs/_guestfs.c +++ b/ruby/ext/guestfs/_guestfs.c @@ -4309,6 +4309,30 @@ static VALUE ruby_guestfs_scrub_freespace (VALUE gv, VALUE dirv) return Qnil; } +static VALUE ruby_guestfs_mkdtemp (VALUE gv, VALUE templatev) +{ + guestfs_h *g; + Data_Get_Struct (gv, guestfs_h, g); + if (!g) + rb_raise (rb_eArgError, "%s: used handle after closing it", "mkdtemp"); + + Check_Type (templatev, T_STRING); + const char *template = StringValueCStr (templatev); + if (!template) + rb_raise (rb_eTypeError, "expected string for parameter %s of %s", + "template", "mkdtemp"); + + char *r; + + r = guestfs_mkdtemp (g, template); + if (r == NULL) + rb_raise (e_Error, "%s", guestfs_last_error (g)); + + VALUE rv = rb_str_new2 (r); + free (r); + return rv; +} + /* Initialize the module. */ void Init__guestfs () { @@ -4655,4 +4679,6 @@ void Init__guestfs () ruby_guestfs_scrub_file, 1); rb_define_method (c_guestfs, "scrub_freespace", ruby_guestfs_scrub_freespace, 1); + rb_define_method (c_guestfs, "mkdtemp", + ruby_guestfs_mkdtemp, 1); } |