Commit f06a349a authored by Debarshi Ray's avatar Debarshi Ray

Use a consistent set of permissions when creating directories

https://bugzilla.gnome.org/show_bug.cgi?id=709417
parent 9ce45bfd
......@@ -27,6 +27,8 @@ GETTEXT_PACKAGE=gnome-control-center-2.0
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Gettext package])
AC_DEFINE(USER_DIR_MODE, 0700, [Permissions for creating the user's config, cache and data directories])
GNOME_DEBUG_CHECK
GNOME_COMPILE_WARNINGS([maximum])
......
......@@ -20,6 +20,8 @@
*
*/
#include <config.h>
#include "bg-pictures-source.h"
#include "cc-background-item.h"
......@@ -610,7 +612,7 @@ bg_pictures_source_init (BgPicturesSource *self)
NULL);
pictures_path = g_get_user_special_dir (G_USER_DIRECTORY_PICTURES);
g_mkdir_with_parents (pictures_path, 0700);
g_mkdir_with_parents (pictures_path, USER_DIR_MODE);
dir = g_file_new_for_path (pictures_path);
g_file_enumerate_children_async (dir,
......@@ -633,7 +635,7 @@ bg_pictures_source_init (BgPicturesSource *self)
g_object_unref (dir);
cache_path = bg_pictures_source_get_cache_path ();
g_mkdir_with_parents (cache_path, 0700);
g_mkdir_with_parents (cache_path, USER_DIR_MODE);
dir = g_file_new_for_path (cache_path);
g_file_enumerate_children_async (dir,
......
......@@ -399,7 +399,7 @@ get_screenshot_async (CcBackgroundPanel *panel)
data->capture_rect.width, data->capture_rect.height, data->capture_rect.x, data->capture_rect.y);
path = g_build_filename (g_get_user_cache_dir (), "gnome-control-center", NULL);
g_mkdir_with_parents (path, 0700);
g_mkdir_with_parents (path, USER_DIR_MODE);
tmpname = g_strdup_printf ("scr-%d.png", g_random_int ());
g_free (panel->priv->screenshot_path);
......@@ -538,7 +538,7 @@ create_save_dir (void)
"gnome-control-center",
"backgrounds",
NULL);
if (g_mkdir_with_parents (path, 0755) < 0)
if (g_mkdir_with_parents (path, USER_DIR_MODE) < 0)
{
g_warning ("Failed to create directory '%s'", path);
g_free (path);
......@@ -635,7 +635,7 @@ set_background (CcBackgroundPanel *panel,
GdkPixbuf *pixbuf;
cache_path = bg_pictures_source_get_cache_path ();
if (g_mkdir_with_parents (cache_path, 0755) < 0)
if (g_mkdir_with_parents (cache_path, USER_DIR_MODE) < 0)
{
g_warning ("Failed to create directory '%s'", cache_path);
g_free (cache_path);
......
......@@ -284,7 +284,7 @@ create_custom_theme (const char *parent)
/* Create the custom directory */
path = custom_theme_dir_path (NULL);
g_mkdir_with_parents (path, 0755);
g_mkdir_with_parents (path, USER_DIR_MODE);
g_free (path);
/* Set the data for index.theme */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment