/**
- * Replace any slash chars in a string with dash
+ * Replace various chars with a dash
*/
static void
-deslashify(char *s)
+cleanupfilename(char *s)
{
int i, len = strlen(s);
for(i = 0; i < len; i++)
- if(s[i] == '/' || s[i] == ':')
+ if(s[i] == '/' || s[i] == ':' || s[i] == '\\' || s[i] == '<' ||
+ s[i] == '>' || s[i] == '|' || s[i] == '*' || s[i] == '?')
s[i] = '-';
}
struct tm tm;
filename = strdup(de->de_ititle);
- deslashify(filename);
+ cleanupfilename(filename);
av_strlcpy(path, dvr_storage, sizeof(path));
if(dvr_flags & DVR_DIR_PER_DAY) {
localtime_r(&de->de_start, &tm);
strftime(fullname, sizeof(fullname), "%F", &tm);
- deslashify(fullname);
+ cleanupfilename(fullname);
snprintf(path + strlen(path), sizeof(path) - strlen(path),
"/%s", fullname);
}
if(dvr_flags & DVR_DIR_PER_CHANNEL) {
chname = strdup(de->de_channel->ch_name);
- deslashify(chname);
+ cleanupfilename(chname);
snprintf(path + strlen(path), sizeof(path) - strlen(path),
"/%s", chname);
free(chname);