提交 1f604116 编写于 作者: G Guido Günther

udev_device_get_devpath might return NULL

Fix crash on strdup in that case.
上级 a4e09c1e
......@@ -947,8 +947,14 @@ static int udevProcessStorage(struct udev_device *device,
{
union _virNodeDevCapData *data = &def->caps->data;
int ret = -1;
const char* devnode;
data->storage.block = strdup(udev_device_get_devnode(device));
devnode = udev_device_get_devnode(device);
if(!devnode) {
VIR_DEBUG("No devnode for '%s'\n", udev_device_get_devpath(device));
goto out;
}
data->storage.block = strdup(devnode);
if (udevGetStringProperty(device,
"DEVNAME",
&data->storage.block) == PROPERTY_ERROR) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册