Code Block Purpose?
Danny Kukawka
danny.kukawka at web.de
Fri May 18 08:05:18 PDT 2007
On Freitag, 18. Mai 2007, Doug Goldstein wrote:
[..]
> Looking at the code.... ci-tracker.c lines 197 to 203:
>
> dbus_error_init (&error);
> ci->uid = dbus_bus_get_unix_user (cit->dbus_connection,
> system_bus_unique_name, &error);
> if (ci->uid == ((unsigned long) -1) || dbus_error_is_set (&error))
> { HAL_WARNING (("Could not get uid for connection: %s %s", error.name,
> error.message));
> dbus_error_free (&error);
> goto error;
> }
>
> We see that dbus_bus_get_unix_user() is failing. The check below that on
> line 199 is invalid since dbus_bus_get_unix_user() returns an unsigned
> long so the casting of -1 to an unsigned long, which in a perfect world
> would be LONG_MAX will differ on amd64 machines and x86 machines which
> means that check will always be bad. Further more, D-Bus returns
> DBUS_UID_UNSET on failure.
and DBUS_UID_UNSET is: ((dbus_uid_t) -1) while dbus_uid_t is unsigned long.
Hence 'ci->uid == ((unsigned long) -1)' looks valid to me.
Danny
More information about the hal
mailing list