From e1eb84db4908465b44a5ed685c62912a694607a6 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 10 Feb 2008 13:41:43 +0100 Subject: Limiting the length of the recording name in timers created via SVDRP in case VDR is run with --vfat --- CONTRIBUTORS | 3 +++ HISTORY | 3 +++ svdrp.c | 25 ++++++++++++++++++++++++- 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 71b14b69..85a19330 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1040,6 +1040,9 @@ Rolf Ahrenberg for some fixes to PLUGINS.html for fixing handling CONFDIR for updating the Makefile of the skincurses plugin + for suggesting to limit the length of the recording name in timers created via + SVDRP in case VDR is run with --vfat, in order to avoid names that are too long + for Windows Ralf Klueber for reporting a bug in cutting a recording if there is only a single editing mark diff --git a/HISTORY b/HISTORY index ad703239..c6889849 100644 --- a/HISTORY +++ b/HISTORY @@ -5613,3 +5613,6 @@ Video Disk Recorder Revision History - Fixed detecting directories in cFileNameList::Load(). - Running the thread that removes deleted recordings at a low priority to (maybe) avoid stuttering replay in case the thread is run during replay. +- Limiting the length of the recording name in timers created via SVDRP in case VDR + is run with --vfat, in order to avoid names that are too long for Windows + (suggested by Rolf Ahrenberg). diff --git a/svdrp.c b/svdrp.c index 2ac3a4bb..bce0ec4f 100644 --- a/svdrp.c +++ b/svdrp.c @@ -10,7 +10,7 @@ * and interact with the Video Disk Recorder - or write a full featured * graphical interface that sits on top of an SVDRP connection. * - * $Id: svdrp.c 1.105 2008/01/13 15:06:25 kls Exp $ + * $Id: svdrp.c 1.106 2008/02/10 13:37:18 kls Exp $ */ #include "svdrp.h" @@ -40,6 +40,8 @@ #include "tools.h" #include "videodir.h" +#define VFAT_MAX_FILENAME 40 // same as MAX_SUBTITLE_LENGTH in recording.c + // --- cSocket --------------------------------------------------------------- cSocket::cSocket(int Port, int Queue) @@ -1179,6 +1181,16 @@ void cSVDRP::CmdMODT(const char *Option) Reply(501, "Error in timer settings"); return; } + else if (VfatFileSystem) { + const char *FileName = timer->File(); + const char *p = strrchr(FileName, '~'); + if (!p) + p = FileName; + if (strlen(p) > VFAT_MAX_FILENAME) { + Reply(501, "File name too long for VFAT file system"); + return; + } + } *timer = t; Timers.SetModified(); isyslog("timer %s modified (%s)", *timer->ToDescr(), timer->HasFlags(tfActive) ? "active" : "inactive"); @@ -1285,6 +1297,17 @@ void cSVDRP::CmdNEWT(const char *Option) if (*Option) { cTimer *timer = new cTimer; if (timer->Parse(Option)) { + if (VfatFileSystem) { + const char *FileName = timer->File(); + const char *p = strrchr(FileName, '~'); + if (!p) + p = FileName; + if (strlen(p) > VFAT_MAX_FILENAME) { + Reply(501, "File name too long for VFAT file system"); + delete timer; + return; + } + } cTimer *t = Timers.GetTimer(timer); if (!t) { Timers.Add(timer); -- cgit v1.2.3