Check for nil values.

This commit is contained in:
Andrea C. Granata 2014-05-04 20:09:15 +02:00
parent 695ee8f87b
commit d88eb2ac77

View file

@ -1078,18 +1078,27 @@ container_create(int argc, VALUE *argv, VALUE self)
thinpool = rb_hash_aref(rb_bdevspecs, ID2SYM(rb_intern("thinpool")));
dir = rb_hash_aref(rb_bdevspecs, ID2SYM(rb_intern("dir")));
if (!NIL_P(fstype))
spec.fstype = StringValuePtr(fstype);
if (!NIL_P(fssize))
spec.fssize = NUM2ULONG(fssize);
if (!NIL_P(zfsroot))
spec.zfs.zfsroot = StringValuePtr(zfsroot);
if (!NIL_P(lvname))
spec.lvm.lv = StringValuePtr(lvname);
if (!NIL_P(vgname))
spec.lvm.vg = StringValuePtr(vgname);
if (!NIL_P(thinpool))
spec.lvm.thinpool = StringValuePtr(thinpool);
if (!NIL_P(dir))
spec.dir = StringValuePtr(dir);
}
args.bdevspecs = &spec;
} else { args.bdevspecs = NULL; }
args.template = StringValuePtr(rb_template);
args.bdevspecs = &spec;
args.bdevtype = NIL_P(rb_bdevtype) ? NULL : StringValuePtr(rb_bdevtype);
args.flags = NIL_P(rb_flags) ? 0 : NUM2INT(rb_flags);
if (!NIL_P(rb_args))