reserve: Fix check for whether acquire succeeded or not

We only deem success if we successfully became the primary name owner.
This commit is contained in:
Arun Raghavan 2020-09-18 15:29:25 -04:00 committed by Wim Taymans
parent 272624fe83
commit 2c8e2f3a36

View file

@ -394,9 +394,12 @@ int rd_device_acquire(struct rd_device *d)
(d->priority < INT32_MAX ? DBUS_NAME_FLAG_ALLOW_REPLACEMENT : 0), (d->priority < INT32_MAX ? DBUS_NAME_FLAG_ALLOW_REPLACEMENT : 0),
&error)) < 0) { &error)) < 0) {
dbus_error_free(&error); dbus_error_free(&error);
res = -EBUSY;
} }
return res;
if (res != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER)
return -EBUSY;
return 0;
} }
int rd_device_request_release(struct rd_device *d) int rd_device_request_release(struct rd_device *d)