vzctl set --save --force: fix segfault on unsupported kernel
Long time ago, commit f18aada made it possible to use vzctl set --save
on an unsupported (ie non-openvz) kernel with --force flag, in order to
save parameters to ctid.conf.
Then, commit 9a9bc8a7 added support for non-openvz kernel, in particular
it added this line:
if (!is_vz_kernel(h))
and is_vz_kernel() added by commit ed33205a is defined as
return h->vzfd != -1;
The problem with this is due to the first patch h can be null.
Fix by checking h for NULL in is_vz_kernel(). While at it, fix the
comment describing the --force meaning for vzctl set.
Found by coverity, CID 996854.
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
2 files changed