mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2026-05-03 13:38:02 +02:00
Respect $UPOWER_CONF_FILE_NAME in up_config_init()
The daemon test in up-self-test instantiates an UpDaemon object, which creates an UpConfig object. Unlike UpDaemon itself, up_config_new() did not check for $UPOWER_CONF_FILE_NAME to find the configuration file name. This had the effect that a make check/distcheck run would always try to use the system wide configuration file, and fail if --sysconfdir wasn't specified appropriately.
This commit is contained in:
parent
5cb1f4a9a3
commit
065c597b88
1 changed files with 9 additions and 1 deletions
|
|
@ -73,15 +73,23 @@ up_config_init (UpConfig *config)
|
|||
{
|
||||
gboolean ret;
|
||||
GError *error = NULL;
|
||||
gchar *filename;
|
||||
|
||||
config->priv = UP_CONFIG_GET_PRIVATE (config);
|
||||
config->priv->keyfile = g_key_file_new ();
|
||||
|
||||
filename = g_strdup (g_getenv ("UPOWER_CONF_FILE_NAME"));
|
||||
if (filename == NULL)
|
||||
filename = g_build_filename (PACKAGE_SYSCONF_DIR,"UPower", "UPower.conf", NULL);
|
||||
|
||||
/* load */
|
||||
ret = g_key_file_load_from_file (config->priv->keyfile,
|
||||
PACKAGE_SYSCONF_DIR "/UPower/UPower.conf",
|
||||
filename,
|
||||
G_KEY_FILE_NONE,
|
||||
&error);
|
||||
|
||||
g_free (filename);
|
||||
|
||||
if (!ret) {
|
||||
g_warning ("failed to load config file: %s",
|
||||
error->message);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue