Fix handling of LXC::Container#start argument

This commit is contained in:
Andre Nathan 2013-12-05 15:27:43 -02:00
parent d6a14c0e96
commit 1e4f1802bd

View file

@ -1024,10 +1024,15 @@ container_start(int argc, VALUE *argv, VALUE self)
struct container_data *data; struct container_data *data;
VALUE rb_use_init, rb_daemonize, rb_close_fds, rb_args, rb_opts; VALUE rb_use_init, rb_daemonize, rb_close_fds, rb_args, rb_opts;
rb_scan_args(argc, argv, "01", &rb_opts); use_init = 0;
if (!NIL_P(rb_opts) && TYPE(rb_opts) != T_HASH) daemonize = 1;
rb_raise(Error, "unable to read start options"); close_fds = 0;
args = NULL;
rb_args = Qnil;
rb_scan_args(argc, argv, "01", &rb_opts);
if (!NIL_P(rb_opts)) {
Check_Type(rb_opts, T_HASH);
rb_use_init = rb_hash_aref(rb_opts, SYMBOL("use_init")); rb_use_init = rb_hash_aref(rb_opts, SYMBOL("use_init"));
use_init = (rb_use_init != Qnil) && (rb_use_init != Qfalse); use_init = (rb_use_init != Qnil) && (rb_use_init != Qfalse);
@ -1039,6 +1044,7 @@ container_start(int argc, VALUE *argv, VALUE self)
rb_args = rb_hash_aref(rb_opts, SYMBOL("args")); rb_args = rb_hash_aref(rb_opts, SYMBOL("args"));
args = NIL_P(rb_args) ? NULL : ruby_to_c_string_array(rb_args); args = NIL_P(rb_args) ? NULL : ruby_to_c_string_array(rb_args);
}
Data_Get_Struct(self, struct container_data, data); Data_Get_Struct(self, struct container_data, data);