MCabber / changeset
| author | Mikael Berthe <mikael@lilotux.net> |
| Sat Oct 27 13:01:03 2007 +0200 (14 months ago) | |
| changeset 1335 | ab1b7f7a682e |
| parent 1334 | f8cfa22cedc2 |
| child 1336 | 8ace83796feb |
Make sure the otr_dir is always slash-terminated
--- 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 @@ static char * otr_get_dir(void){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)
