aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Rostovtsev <tetromino@gentoo.org>2012-09-07 19:03:32 -0400
committerAlexandre Rostovtsev <tetromino@gentoo.org>2012-09-07 19:16:07 -0400
commit48f9a65ff49996468b8e56258ca945483597ee9e (patch)
tree868a9768e291dcece7649950841903894515a497
parentversion 1.0 (diff)
downloadopenrc-settingsd-48f9a65ff49996468b8e56258ca945483597ee9e.tar.gz
openrc-settingsd-48f9a65ff49996468b8e56258ca945483597ee9e.tar.bz2
openrc-settingsd-48f9a65ff49996468b8e56258ca945483597ee9e.zip
Run env-update after updating an env.d file
-rw-r--r--Makefile.am1
-rw-r--r--src/localed.c25
2 files changed, 18 insertions, 8 deletions
diff --git a/Makefile.am b/Makefile.am
index bdfb3dd..70a9ec4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -69,6 +69,7 @@ AM_CPPFLAGS = \
-DLIBEXECDIR=\""$(libexecdir)"\" \
-DPKGDATADIR=\""$(pkgdatadir)"\" \
-DPIDFILE=\""$(pidfile)"\" \
+ -DENV_UPDATE=\""$(prefix)/sbin/env-update"\" \
$(OPENRC_SETTINGSD_CFLAGS) \
-I$(top_srcdir)/src \
-I$(top_builddir)/src \
diff --git a/src/localed.c b/src/localed.c
index efc4a8b..008ed16 100644
--- a/src/localed.c
+++ b/src/localed.c
@@ -791,6 +791,7 @@ on_handle_set_locale_authorized_cb (GObject *source_object,
struct invoked_locale *data;
gchar **loc, **var, **val, **locale_values = NULL;
ShellParser *locale_file_parsed = NULL;
+ gint status = 0;
data = (struct invoked_locale *) user_data;
if (!check_polkit_finish (res, &err)) {
@@ -822,16 +823,14 @@ on_handle_set_locale_authorized_cb (GObject *source_object,
if (!found) {
g_dbus_method_invocation_return_dbus_error (data->invocation, DBUS_ERROR_INVALID_ARGS,
"Invalid locale variable name or value");
- G_UNLOCK (locale);
- goto out;
+ goto unlock;
}
}
}
if ((locale_file_parsed = shell_parser_new (locale_file, &err)) == NULL) {
g_dbus_method_invocation_return_gerror (data->invocation, err);
- G_UNLOCK (locale);
- goto out;
+ goto unlock;
}
if (shell_parser_is_empty (locale_file_parsed)) {
@@ -839,8 +838,7 @@ on_handle_set_locale_authorized_cb (GObject *source_object,
shell_parser_free (locale_file_parsed);
if ((locale_file_parsed = shell_parser_new_from_string (locale_file, "# Configuration file for eselect\n# This file has been automatically generated\n", &err)) == NULL) {
g_dbus_method_invocation_return_gerror (data->invocation, err);
- G_UNLOCK (locale);
- goto out;
+ goto unlock;
}
}
@@ -853,8 +851,7 @@ on_handle_set_locale_authorized_cb (GObject *source_object,
if (!shell_parser_save (locale_file_parsed, &err)) {
g_dbus_method_invocation_return_gerror (data->invocation, err);
- G_UNLOCK (locale);
- goto out;
+ goto unlock;
}
g_strfreev (locale);
@@ -867,8 +864,20 @@ on_handle_set_locale_authorized_cb (GObject *source_object,
}
}
+ if (!g_spawn_command_line_sync (ENV_UPDATE " --no-ldconfig", NULL, NULL, &status, &err)) {
+ g_dbus_method_invocation_return_gerror (data->invocation, err);
+ goto unlock;
+ }
+ if (status) {
+ g_dbus_method_invocation_return_dbus_error (data->invocation, DBUS_ERROR_FAILED,
+ "env-update failed");
+ goto unlock;
+ }
+
openrc_settingsd_localed_locale1_complete_set_locale (locale1, data->invocation);
openrc_settingsd_localed_locale1_set_locale (locale1, (const gchar * const *) locale);
+
+ unlock:
G_UNLOCK (locale);
out: