From 90bf4cce0865803dc8ab32d6bc2b130797b378e3 Mon Sep 17 00:00:00 2001 From: simon Date: Sat, 22 Mar 2003 09:49:20 +0000 Subject: [PATCH] Yikes - saving of Default Settings must have been broken for some time! The load code in settings.c was translating an empty string into "Default Settings" to pass to {win,ux}store, whereas the save code was passing the empty string straight down and expecting it to be dealt with. So, a policy decision: the precise name of the "Default Settings" special session _at the storage level_ is up to the individual platform storage code to decide, and all platforms MUST assume Default Settings is meant if they receive NULL or the empty string as a session name. git-svn-id: svn://svn.tartarus.org/sgt/putty@2974 cda61777-01e9-0310-a592-d414129be87e --- settings.c | 5 +---- winstore.c | 6 ++++++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/settings.c b/settings.c index c3f8c883..2d6a1fb0 100644 --- a/settings.c +++ b/settings.c @@ -631,10 +631,7 @@ void load_open_settings(void *sesskey, int do_host, Config *cfg) void do_defaults(char *session, Config * cfg) { - if (session) - load_settings(session, TRUE, cfg); - else - load_settings("Default Settings", FALSE, cfg); + load_settings(session, (session != NULL && *session), cfg); } static int sessioncmp(const void *av, const void *bv) diff --git a/winstore.c b/winstore.c index a69d58d0..e0d9a780 100644 --- a/winstore.c +++ b/winstore.c @@ -67,6 +67,9 @@ void *open_settings_w(const char *sessionname) int ret; char *p; + if (!sessionname || !*sessionname) + sessionname = "Default Settings"; + p = smalloc(3 * strlen(sessionname) + 1); mungestr(sessionname, p); @@ -107,6 +110,9 @@ void *open_settings_r(const char *sessionname) HKEY subkey1, sesskey; char *p; + if (!sessionname || !*sessionname) + sessionname = "Default Settings"; + p = smalloc(3 * strlen(sessionname) + 1); mungestr(sessionname, p); -- 2.11.0