提交 3427b36c 编写于 作者: M Marc Hartmayer 提交者: Martin Kletzander

node_device: Check return value for udev_new()

The comment was actually wrong as
https://www.freedesktop.org/software/systemd/man/udev_new.html#
mentions that on failure NULL is returned.  Also the same return value
is checked in src/interface/interface_backend_udev.c already.
Signed-off-by: NMarc Hartmayer <mhartmay@linux.vnet.ibm.com>
上级 579fc9a2
...@@ -1563,13 +1563,12 @@ static int nodeStateInitialize(bool privileged, ...@@ -1563,13 +1563,12 @@ static int nodeStateInitialize(bool privileged,
if (udevPCITranslateInit(privileged) < 0) if (udevPCITranslateInit(privileged) < 0)
goto cleanup; goto cleanup;
/*
* http://www.kernel.org/pub/linux/utils/kernel/hotplug/libudev/libudev-udev.html#udev-new
*
* indicates no return value other than success, so we don't check
* its return value.
*/
udev = udev_new(); udev = udev_new();
if (!udev) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("failed to create udev context"));
goto cleanup;
}
#if HAVE_UDEV_LOGGING #if HAVE_UDEV_LOGGING
/* cast to get rid of missing-format-attribute warning */ /* cast to get rid of missing-format-attribute warning */
udev_set_log_fn(udev, (udevLogFunctionPtr) udevLogFunction); udev_set_log_fn(udev, (udevLogFunctionPtr) udevLogFunction);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册