From 043b45e840bf742bb54749b2f4cec2a722109b79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stig=20Bj=C3=B8rlykke?= Date: Tue, 30 Jan 2018 12:27:30 +0100 Subject: [PATCH] UI: Rename profiles without delete MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do not try to delete the old profile name after renaming. In most cases it will not exist, but when using a case-insensitive file system this will delete the renamed profile if only changing capitalizations (first it's renamed and then it's deleted). Change-Id: I27d2d22d2353b09f2041d82ea1cf1bae37a1ce3d Reviewed-on: https://code.wireshark.org/review/25515 Petri-Dish: Stig Bjørlykke Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- ui/profile.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/profile.c b/ui/profile.c index f1b04901b8..c01d115492 100644 --- a/ui/profile.c +++ b/ui/profile.c @@ -203,8 +203,6 @@ gchar *apply_profile_changes(void) g_free(pf_dir_path2); } profile1->status = PROF_STAT_EXISTS; - g_free (profile1->reference); - profile1->reference = g_strdup(profile1->name); } } fl1 = g_list_next(fl1); @@ -223,7 +221,9 @@ gchar *apply_profile_changes(void) /* Profile exists in both lists */ found = TRUE; } else if (strcmp(profile1->name, profile2->reference)==0) { - /* Profile has been renamed */ + /* Profile has been renamed, update reference to the new name */ + g_free (profile2->reference); + profile2->reference = g_strdup(profile2->name); found = TRUE; } }