• Holger Macht's avatar
    avoid reliance on DT_REG so we work on reiserfs as well · 0b59d3e7
    Holger Macht authored
    (with minor fixes from davidz for avoiding memory leaks)
    Recently I wondered why PolicyKit (especially polkit-auth) does not work
    on my system. While debugging, I noticed that the corresponding code works
    in my home directory, but not in the root filesystem.
    readdir() and its d_type are the culprits. Quoting the readdir manpage:
    Other than Linux, the d_type field is available mainly only on BSD
    systems.  This field makes it possible to avoid the expense of calling
    stat() if further actions depend on the type of the file.
    Filesystems may fill DT_UNKNOWN into this field, which reiserfs does, so
    call stat instead, which always does the right thing.
    Signed-off-by: Holger Macht's avatarHolger Macht <hmacht@suse.de>
polkit-policy-cache.c 17.6 KB