Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
DVR: Fix the filename builder when no extra dirs are used, fixes #287…
…9, fixes#2884
  • Loading branch information
perexg committed May 25, 2015
1 parent afb044d commit c918243
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/dvr/dvr_rec.c
Expand Up @@ -350,7 +350,7 @@ static str_substitute_t dvr_subs_tally[] = {
static char *dvr_find_last_path_component(char *path)
{
char *res, *p;
for (p = res = path; *p; p++) {
for (p = path, res = NULL; *p; p++) {
if (*p == '\\') {
p++;
} else {
Expand Down Expand Up @@ -475,8 +475,16 @@ pvr_generate_filename(dvr_entry_t *de, const streaming_start_t *ss)

/* Deescape directory path and create directory tree */
dirsep = dvr_find_last_path_component(path + l);
*dirsep = '\0';
dirsep++;
if (dirsep) {
*dirsep = '\0';
dirsep++;
} else {
if (l > 0) {
assert(path[l-1] == '/');
path[l-1] = '\0';
}
dirsep = path + l;
}
str_unescape(path, filename, sizeof(filename));
if (makedirs(filename, cfg->dvr_muxcnf.m_directory_permissions, -1, -1) != 0)
return -1;
Expand Down

0 comments on commit c918243

Please sign in to comment.