mirror of
https://github.com/irssi/irssi.git
synced 2025-02-02 15:08:01 -05:00
Escape % chars in logs so strftime() won't mess with them.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1667 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
11072cc4d7
commit
d1d13a4b36
@ -365,6 +365,26 @@ static void autologs_close_all(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* '%' -> '%%', '/' -> '_' */
|
||||||
|
static char *escape_target(const char *target)
|
||||||
|
{
|
||||||
|
char *str, *p;
|
||||||
|
|
||||||
|
p = str = g_malloc(strlen(target)*2+1);
|
||||||
|
while (*target != '\0') {
|
||||||
|
if (*target == '/')
|
||||||
|
*p++ = '_';
|
||||||
|
else {
|
||||||
|
if (*target == '%')
|
||||||
|
*p++ = '%';
|
||||||
|
*p++ = *target++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*p = '\0';
|
||||||
|
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
static void autolog_open(SERVER_REC *server, const char *target)
|
static void autolog_open(SERVER_REC *server, const char *target)
|
||||||
{
|
{
|
||||||
LOG_REC *log;
|
LOG_REC *log;
|
||||||
@ -378,9 +398,10 @@ static void autolog_open(SERVER_REC *server, const char *target)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* '/' -> '_' - don't even accidentally try to log to
|
/* '/' -> '_' - don't even accidentally try to log to
|
||||||
#../../../file if you happen to join to such channel.. */
|
#../../../file if you happen to join to such channel..
|
||||||
fixed_target = g_strdup(target);
|
|
||||||
replace_chars(fixed_target, '/', '_');
|
'%' -> '%%' - so strftime() won't mess with them */
|
||||||
|
fixed_target = escape_target(target);
|
||||||
fname = parse_special_string(autolog_path, server, NULL,
|
fname = parse_special_string(autolog_path, server, NULL,
|
||||||
fixed_target, NULL, 0);
|
fixed_target, NULL, 0);
|
||||||
g_free(fixed_target);
|
g_free(fixed_target);
|
||||||
|
Loading…
Reference in New Issue
Block a user