Check for nil values.
This commit is contained in:
parent
695ee8f87b
commit
d88eb2ac77
|
@ -1078,18 +1078,27 @@ container_create(int argc, VALUE *argv, VALUE self)
|
||||||
thinpool = rb_hash_aref(rb_bdevspecs, ID2SYM(rb_intern("thinpool")));
|
thinpool = rb_hash_aref(rb_bdevspecs, ID2SYM(rb_intern("thinpool")));
|
||||||
dir = rb_hash_aref(rb_bdevspecs, ID2SYM(rb_intern("dir")));
|
dir = rb_hash_aref(rb_bdevspecs, ID2SYM(rb_intern("dir")));
|
||||||
|
|
||||||
|
if (!NIL_P(fstype))
|
||||||
spec.fstype = StringValuePtr(fstype);
|
spec.fstype = StringValuePtr(fstype);
|
||||||
|
if (!NIL_P(fssize))
|
||||||
spec.fssize = NUM2ULONG(fssize);
|
spec.fssize = NUM2ULONG(fssize);
|
||||||
|
if (!NIL_P(zfsroot))
|
||||||
spec.zfs.zfsroot = StringValuePtr(zfsroot);
|
spec.zfs.zfsroot = StringValuePtr(zfsroot);
|
||||||
|
if (!NIL_P(lvname))
|
||||||
spec.lvm.lv = StringValuePtr(lvname);
|
spec.lvm.lv = StringValuePtr(lvname);
|
||||||
|
if (!NIL_P(vgname))
|
||||||
spec.lvm.vg = StringValuePtr(vgname);
|
spec.lvm.vg = StringValuePtr(vgname);
|
||||||
|
if (!NIL_P(thinpool))
|
||||||
spec.lvm.thinpool = StringValuePtr(thinpool);
|
spec.lvm.thinpool = StringValuePtr(thinpool);
|
||||||
|
if (!NIL_P(dir))
|
||||||
spec.dir = StringValuePtr(dir);
|
spec.dir = StringValuePtr(dir);
|
||||||
|
|
||||||
}
|
args.bdevspecs = &spec;
|
||||||
|
|
||||||
|
} else { args.bdevspecs = NULL; }
|
||||||
|
|
||||||
args.template = StringValuePtr(rb_template);
|
args.template = StringValuePtr(rb_template);
|
||||||
args.bdevspecs = &spec;
|
|
||||||
args.bdevtype = NIL_P(rb_bdevtype) ? NULL : StringValuePtr(rb_bdevtype);
|
args.bdevtype = NIL_P(rb_bdevtype) ? NULL : StringValuePtr(rb_bdevtype);
|
||||||
args.flags = NIL_P(rb_flags) ? 0 : NUM2INT(rb_flags);
|
args.flags = NIL_P(rb_flags) ? 0 : NUM2INT(rb_flags);
|
||||||
if (!NIL_P(rb_args))
|
if (!NIL_P(rb_args))
|
||||||
|
|
Loading…
Reference in a new issue