# HG changeset patch # User Mikael Berthe # Date 1193482863 -7200 # Node ID ab1b7f7a682efb7b7c01370bb62cc8419d8ac37a # Parent f8cfa22cedc23ea219caa470a5f19abae92c1754 Make sure the otr_dir is always slash-terminated diff -r f8cfa22cedc2 -r ab1b7f7a682e mcabber/src/otr.c --- a/mcabber/src/otr.c Sat Oct 27 12:01:55 2007 +0200 +++ b/mcabber/src/otr.c Sat Oct 27 13:01:03 2007 +0200 @@ -163,10 +163,21 @@ { char * configured_dir = (char *)settings_opt_get("otr_dir"); - if (configured_dir) - return expand_filename(configured_dir); - else + if (configured_dir && *configured_dir) { + char *xp_conf_dir; + int l; + xp_conf_dir = expand_filename(configured_dir); + // The path must be slash-terminated + l = strlen(xp_conf_dir); + if (xp_conf_dir[l-1] != '/') { + char *xp_conf_dir_tmp = xp_conf_dir; + xp_conf_dir = g_strdup_printf("%s/", xp_conf_dir_tmp); + g_free(xp_conf_dir_tmp); + } + return xp_conf_dir; + } else { return expand_filename("~/.mcabber/otr/"); + } } static ConnContext * otr_get_context(const char *buddy)