HomeClusterLabs Projects

Low: libcrmcommon: use return code correctly when getting daemon user ID

Description

Low: libcrmcommon: use return code correctly when getting daemon user ID

Previously, pcmk_daemon_user() would return pcmk_ok only on the first
successful call -- subsequent (successful) calls would always return
pcmk_err_generic, even though the IDs were available.

This didn't cause problems because all the callers except one checked whether
the return value was negative, and pcmk_err_generic isn't negative, so they
treated it like success. Now, pcmk_daemon_user() will always return a negative
value for errors, so everything now works as intended rather than by accident.

The one caller that checked for pcmk_ok was crm_add_logfile(). The effect would
be that if crm_add_logfile() were called after pcmk_daemon_user() had already
been called at least once, it would not change the ownership and mode of the
log file. This will now work correctly.

Details

Provenance
kgaillotAuthored on May 17 2021, 12:22 PM
Parents
rPa3bfc02fc477: Refactor: fencer: allocate cluster object dynamically
Branches
Unknown
Tags
Unknown

Event Timeline