comparison mcabber/src/otr.c @ 1335:ab1b7f7a682e 0.9.4

Make sure the otr_dir is always slash-terminated
author Mikael Berthe <mikael@lilotux.net>
date Sat, 27 Oct 2007 13:01:03 +0200
parents cb400799db8f
children 8a05feb23c5a
comparison
equal deleted inserted replaced
1334:f8cfa22cedc2 1335:ab1b7f7a682e
161 161
162 static char * otr_get_dir(void) 162 static char * otr_get_dir(void)
163 { 163 {
164 char * configured_dir = (char *)settings_opt_get("otr_dir"); 164 char * configured_dir = (char *)settings_opt_get("otr_dir");
165 165
166 if (configured_dir) 166 if (configured_dir && *configured_dir) {
167 return expand_filename(configured_dir); 167 char *xp_conf_dir;
168 else 168 int l;
169 xp_conf_dir = expand_filename(configured_dir);
170 // The path must be slash-terminated
171 l = strlen(xp_conf_dir);
172 if (xp_conf_dir[l-1] != '/') {
173 char *xp_conf_dir_tmp = xp_conf_dir;
174 xp_conf_dir = g_strdup_printf("%s/", xp_conf_dir_tmp);
175 g_free(xp_conf_dir_tmp);
176 }
177 return xp_conf_dir;
178 } else {
169 return expand_filename("~/.mcabber/otr/"); 179 return expand_filename("~/.mcabber/otr/");
180 }
170 } 181 }
171 182
172 static ConnContext * otr_get_context(const char *buddy) 183 static ConnContext * otr_get_context(const char *buddy)
173 { 184 {
174 int null = 0; 185 int null = 0;