int len = strlen(s);
char *s1, *p;
- s1 = intlconv_utf8safestr(cfg->dvr_charset_id, s, len * 2);
+ s1 = intlconv_utf8safestr(cfg->dvr_charset_id, s, (len * 2) + 1);
if (s1 == NULL) {
tvherror("dvr", "Unsupported charset %s using ASCII", cfg->dvr_charset);
s1 = intlconv_utf8safestr(intlconv_charset_id("ASCII", 1, 1),
memcpy(path, filename, j);
path[j] = '\0';
htsstr_unescape_to(s, path + j, sizeof(path) - j);
+
+ if (tally > 0) {
+ htsstr_unescape_to(filename + j, ptmp, sizeof(ptmp));
+ if (strcmp(ptmp, s) == 0) {
+ free(s);
+ tvherror("dvr", "unable to create unique name (missing $n in format string?)");
+ return -1;
+ }
+ }
+
free(s);
if(stat(path, &st) == -1) {
}
if(pvr_generate_filename(de, ss) != 0) {
- dvr_rec_fatal_error(de, "Unable to create directories");
+ dvr_rec_fatal_error(de, "Unable to create file");
return -1;
}