Commit f722b302 authored by Richard Hughes's avatar Richard Hughes
Browse files

libfwupd: Fix adding multiple flags to devices

Ignore the request if _all_ the new flags are already set, not just any of them.
parent ed0af244
......@@ -1270,7 +1270,7 @@ fwupd_device_add_flag (FwupdDevice *device, FwupdDeviceFlags flag)
g_return_if_fail (FWUPD_IS_DEVICE (device));
if (flag == 0)
if ((priv->flags & flag) > 0)
if ((priv->flags | flag) == priv->flags)
priv->flags |= flag;
g_object_notify (G_OBJECT (device), "flags");
......@@ -338,7 +338,11 @@ fwupd_device_func (void)
fwupd_device_add_guid (dev, "00000000-0000-0000-0000-000000000000");
fwupd_device_add_icon (dev, "input-gaming");
fwupd_device_add_icon (dev, "input-mouse");
fwupd_device_add_flag (dev, FWUPD_DEVICE_FLAG_REQUIRE_AC);
fwupd_device_add_flag (dev, FWUPD_DEVICE_FLAG_UPDATABLE |
g_assert_true (fwupd_device_has_flag (dev, FWUPD_DEVICE_FLAG_REQUIRE_AC));
g_assert_true (fwupd_device_has_flag (dev, FWUPD_DEVICE_FLAG_UPDATABLE));
g_assert_false (fwupd_device_has_flag (dev, FWUPD_DEVICE_FLAG_HISTORICAL));
rel = fwupd_release_new ();
fwupd_release_add_flag (rel, FWUPD_RELEASE_FLAG_TRUSTED_PAYLOAD);
fwupd_release_add_checksum (rel, "deadbeef");
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment