[gnome-initial-setup] summary: Make sure to make the skeleton dir with the proper perms
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup] summary: Make sure to make the skeleton dir with the proper perms
- Date: Thu, 4 Oct 2012 21:51:37 +0000 (UTC)
commit 056453a5d7f829706d93182f4ee76a0ad50f0bb9
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Oct 4 18:49:29 2012 -0300
summary: Make sure to make the skeleton dir with the proper perms
Use install to ensure that the directory is created with the
permissions of the user.
.../pages/summary/gis-summary-page.c | 29 ++++++++++++-------
1 files changed, 18 insertions(+), 11 deletions(-)
---
diff --git a/gnome-initial-setup/pages/summary/gis-summary-page.c b/gnome-initial-setup/pages/summary/gis-summary-page.c
index 62221cb..eb7df58 100644
--- a/gnome-initial-setup/pages/summary/gis-summary-page.c
+++ b/gnome-initial-setup/pages/summary/gis-summary-page.c
@@ -55,6 +55,19 @@ connect_to_gdm (GdmGreeter **greeter,
return res;
}
+static gboolean
+pkinstall(char *one, char *two, GError **error)
+{
+ char *argv[] = { "/usr/bin/pkexec",
+ "install",
+ "--owner", (char *) user,
+ "--group", (char *) user,
+ "--mode", "755",
+ one, two };
+
+ return g_spawn_sync (NULL, argv, NULL, 0, NULL, NULL, NULL, NULL, NULL, error);
+}
+
static void
copy_file_to_tmpfs (GFile *dest_base,
const char *dir,
@@ -64,15 +77,9 @@ copy_file_to_tmpfs (GFile *dest_base,
char *src = g_build_filename (dir, path, NULL);
char *basename = g_path_get_basename (src);
char *dest = g_build_filename (g_file_get_path (dest_base), basename, NULL);
- char *argv[] = { "/usr/bin/pkexec",
- "install",
- "--owner", (char *) user,
- "--group", (char *) user,
- "--mode", "755",
- src, dest };
GError *error = NULL;
- if (!g_spawn_sync (NULL, argv, NULL, 0, NULL, NULL, NULL, NULL, NULL, &error)) {
+ if (!pkinstall (src, dest, &error) {
g_warning ("Unable to copy %s to %s: %s",
src, dest, error->message);
g_error_free (error);
@@ -89,13 +96,13 @@ get_skeleton_dir (SummaryData *data)
static void
copy_files_to_tmpfs (SummaryData *data)
{
- GFile *dest = g_file_new_for_path (get_skeleton_dir (data));
+ char *dest = get_skeleton_dir (data);
const char *user = act_user_get_user_name (data->user_account);
GError *error = NULL;
- if (!g_file_make_directory_with_parents (dest, NULL, &error)) {
- g_warning ("Unable to make new skeleton folder: %s",
- error->message);
+ if (!pkinstall ("--directory", dest, &error)) {
+ g_warning ("Unable to make directory: %s",
+ dest, error->message);
goto out;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]