提交 df7291c3 编写于 作者: J Ján Tomko

udevProcessFloppy; remove unnecessary allocation

Use udevHasDeviceProperty instead of udevGetStringProperty.
We do not need to copy the string since we do not need it.

Also add braces around the if body, since the change made
syntax check complain.
上级 61cafffb
......@@ -891,17 +891,14 @@ static int udevProcessFloppy(struct udev_device *device,
{
int tmp_int = 0;
int has_media = 0;
char *tmp_str = NULL;
if ((udevGetIntProperty(device, "DKD_MEDIA_AVAILABLE",
&tmp_int, 0) == PROPERTY_FOUND))
&tmp_int, 0) == PROPERTY_FOUND)) {
/* USB floppy */
has_media = tmp_int;
else if (udevGetStringProperty(device, "ID_FS_LABEL",
&tmp_str) == PROPERTY_FOUND) {
} else if (udevHasDeviceProperty(device, "ID_FS_LABEL")) {
/* Legacy floppy */
has_media = 1;
VIR_FREE(tmp_str);
}
return udevProcessRemoveableMedia(device, def, has_media);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册