From: Jaroslav Kysela Date: Thu, 25 Jan 2018 14:39:21 +0000 (+0100) Subject: DVR: show a proper error if the DVR directory is not accessible, fixes #4757 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=06c7295655d0b11457e1ecab924e4b475335b4b5;p=thirdparty%2Ftvheadend.git DVR: show a proper error if the DVR directory is not accessible, fixes #4757 --- diff --git a/src/dvr/dvr_rec.c b/src/dvr/dvr_rec.c index 3de952724..903a661ce 100644 --- a/src/dvr/dvr_rec.c +++ b/src/dvr/dvr_rec.c @@ -71,6 +71,7 @@ dvr_rec_subscribe(dvr_entry_t *de) access_t *aa; uint32_t rec_count, net_count; int pri, c1, c2; + struct stat st; assert(de->de_s == NULL); assert(de->de_chain == NULL); @@ -112,6 +113,11 @@ dvr_rec_subscribe(dvr_entry_t *de) } access_destroy(aa); + if(stat(de->de_config->dvr_storage, &st) || !S_ISDIR(st.st_mode)) { + tvherror(LS_DVR, "the directory '%s' is not accessible", de->de_config->dvr_storage); + return -EIO; + } + pro = de->de_config->dvr_profile; prch = malloc(sizeof(*prch)); profile_chain_init(prch, pro, de->de_channel); @@ -1082,7 +1088,7 @@ cut1: } } - if(stat(path, &st) == -1) { + if (stat(path, &st) == -1) { tvhdebug(LS_DVR, "File \"%s\" -- %s -- Using for recording", path, strerror(errno)); break; @@ -1162,6 +1168,7 @@ dvr_rec_start(dvr_entry_t *de, const streaming_start_t *ss) htsmsg_t *info, *e; htsmsg_field_t *f; muxer_t *muxer; + struct stat st; int i; if (!cfg) { @@ -1174,6 +1181,11 @@ dvr_rec_start(dvr_entry_t *de, const streaming_start_t *ss) return -1; } + if (stat(cfg->dvr_storage, &st) || !S_ISDIR(st.st_mode)) { + dvr_rec_fatal_error(de, "Unable to create file in directory '%s", cfg->dvr_storage); + return -1; + } + if (!dvr_vfs_rec_start_check(cfg)) { dvr_rec_fatal_error(de, "Not enough free disk space"); return SM_CODE_NO_SPACE;