Fix handling of LXC::Container#start argument
This commit is contained in:
parent
d6a14c0e96
commit
1e4f1802bd
28
ext/lxc.c
28
ext/lxc.c
|
@ -1024,21 +1024,27 @@ 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;
|
||||||
|
|
||||||
|
use_init = 0;
|
||||||
|
daemonize = 1;
|
||||||
|
close_fds = 0;
|
||||||
|
args = NULL;
|
||||||
|
rb_args = Qnil;
|
||||||
|
|
||||||
rb_scan_args(argc, argv, "01", &rb_opts);
|
rb_scan_args(argc, argv, "01", &rb_opts);
|
||||||
if (!NIL_P(rb_opts) && TYPE(rb_opts) != T_HASH)
|
if (!NIL_P(rb_opts)) {
|
||||||
rb_raise(Error, "unable to read start options");
|
Check_Type(rb_opts, T_HASH);
|
||||||
|
rb_use_init = rb_hash_aref(rb_opts, SYMBOL("use_init"));
|
||||||
|
use_init = (rb_use_init != Qnil) && (rb_use_init != Qfalse);
|
||||||
|
|
||||||
rb_use_init = rb_hash_aref(rb_opts, SYMBOL("use_init"));
|
rb_daemonize = rb_hash_aref(rb_opts, SYMBOL("daemonize"));
|
||||||
use_init = (rb_use_init != Qnil) && (rb_use_init != Qfalse);
|
daemonize = (rb_daemonize != Qnil) && (rb_daemonize != Qfalse);
|
||||||
|
|
||||||
rb_daemonize = rb_hash_aref(rb_opts, SYMBOL("daemonize"));
|
rb_close_fds = rb_hash_aref(rb_opts, SYMBOL("close_fds"));
|
||||||
daemonize = (rb_daemonize != Qnil) && (rb_daemonize != Qfalse);
|
close_fds = (rb_close_fds != Qnil) && (rb_close_fds != Qfalse);
|
||||||
|
|
||||||
rb_close_fds = rb_hash_aref(rb_opts, SYMBOL("close_fds"));
|
rb_args = rb_hash_aref(rb_opts, SYMBOL("args"));
|
||||||
close_fds = (rb_close_fds != Qnil) && (rb_close_fds != Qfalse);
|
args = NIL_P(rb_args) ? NULL : ruby_to_c_string_array(rb_args);
|
||||||
|
}
|
||||||
rb_args = rb_hash_aref(rb_opts, SYMBOL("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);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue