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-Tag: v4.2.6~37 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f34ee312081da623b870ca7e541c585ef10af677;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 a08f198e7..b47de2b75 100644 --- a/src/dvr/dvr_rec.c +++ b/src/dvr/dvr_rec.c @@ -70,6 +70,7 @@ dvr_rec_subscribe(dvr_entry_t *de) access_t *aa; uint32_t rec_count, net_count; int c1, c2; + struct stat st; assert(de->de_s == NULL); assert(de->de_chain == NULL); @@ -109,6 +110,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); @@ -848,7 +854,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; @@ -928,6 +934,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) { @@ -940,6 +947,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;