From 4522bfc2d2d2bce6f63f13991d6ceb3034d07779 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Mon, 06 Nov 2017 17:14:47 -0500 Subject: mq_profiles_insert(): Fix directory creation Wow that was stupid. --- (limited to 'src/config/profiles.c') diff --git a/src/config/profiles.c b/src/config/profiles.c index 8ee8acb..040f87c 100644 --- a/src/config/profiles.c +++ b/src/config/profiles.c @@ -208,6 +208,7 @@ gchar * mq_profiles_insert(MqProfiles *profiles, const gchar *name, const gchar *color) { gchar *id; + gchar *dir; /* The ID must be safe for both the file system and HTML5 "name" and * "id" attributes. To make profile directories portable to other file @@ -220,10 +221,13 @@ mq_profiles_insert(MqProfiles *profiles, const gchar *name, const gchar *color) /* Make sure the profile directory can be created and doesn't already * exist (or, on a case-insensitive file system, a directory by the same * name but in a different case doesn't exist). */ - if (g_mkdir(profiles->config_dir, 0700) != 0) { + dir = g_build_filename(profiles->config_dir, id, NULL); + if (g_mkdir(dir, 0700) != 0) { g_free(id); + g_free(dir); return NULL; } + g_free(dir); mq_profiles_set_name(profiles, id, name); mq_profiles_set_color(profiles, id, color); -- cgit v0.9.1