From patchwork Sat Oct 1 10:35:30 2005 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Klaus Schmidinger X-Patchwork-Id: 12051 Received: from tiger.cadsoft.de ([217.7.101.210]) by www.linuxtv.org with esmtp (Exim 4.50) id 1ELeiL-0001m2-Dg for vdr@linuxtv.org; Sat, 01 Oct 2005 12:35:33 +0200 Received: from raven.cadsoft.de (raven.cadsoft.de [217.7.101.211]) by tiger.cadsoft.de (8.12.7/8.12.7) with ESMTP id j91AZWrc011955 for ; Sat, 1 Oct 2005 12:35:32 +0200 Received: from [192.168.100.10] (hawk.cadsoft.de [192.168.100.10]) by raven.cadsoft.de (8.13.3/8.13.3) with ESMTP id j91AZVSN004328 for ; Sat, 1 Oct 2005 12:35:31 +0200 Message-ID: <433E6672.9050707@cadsoft.de> Date: Sat, 01 Oct 2005 12:35:30 +0200 From: Klaus Schmidinger Organization: CadSoft Computer GmbH User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050716) X-Accept-Language: en MIME-Version: 1.0 To: vdr@linuxtv.org Subject: Re: [vdr] vdr-1.3.33, .update detection broken if recording dir != /video References: <43374108.4080008@uklinux.net> In-Reply-To: <43374108.4080008@uklinux.net> X-Greylist: Sender DNS name whitelisted, not delayed by milter-greylist-2.0 (tiger.cadsoft.de [217.7.101.210]); Sat, 01 Oct 2005 12:35:32 +0200 (CEST) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0 (raven.cadsoft.de [192.168.1.1]); Sat, 01 Oct 2005 12:35:32 +0200 (CEST) X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Klaus Schmidinger's VDR List-Id: Klaus Schmidinger's VDR List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Oct 2005 10:35:33 -0000 Status: O X-Status: X-Keywords: X-UID: 5252 Jon Burgess wrote: > I just found that the .update detection is broken for me with > vdr-1.3.33. I performed and strace on vdr and it is not using the > correct recording location: > > stat("/video/.update", 0x7fffffc1e0d0) = -1 ENOENT (No such file or > directory) > > I place my recordings in /video0 using "-v /video0". It looks like the > problem is the change which adds the assignment of updateFileName into > the constructor of cRecordings: > > cRecordings Recordings; > > cRecordings::cRecordings(bool Deleted) > :cThread("video directory scanner") > { > updateFileName = strdup(AddDirectory(VideoDirectory, ".update")); > > It looks like the Recordings object is instantiated before the > VideoDirectory has been parsed from the commandline, hence > updateFileName always points to the default VIDEODIR. The attached patch should fix this. Klaus --- recording.h 2005/09/25 14:30:13 1.44 +++ recording.h 2005/10/01 10:24:41 @@ -93,10 +93,11 @@ class cRecordings : public cList, public cThread { private: - char *updateFileName; + static char *updateFileName; bool deleted; time_t lastUpdate; int state; + const char *UpdateFileName(void); void Refresh(bool Foreground = false); void ScanVideoDir(const char *DirName, bool Foreground = false); protected: --- recording.c 2005/09/25 14:29:49 1.119 +++ recording.c 2005/10/01 10:29:02 @@ -743,10 +743,11 @@ cRecordings Recordings; +char *cRecordings::updateFileName = NULL; + cRecordings::cRecordings(bool Deleted) :cThread("video directory scanner") { - updateFileName = strdup(AddDirectory(VideoDirectory, ".update")); deleted = Deleted; lastUpdate = 0; state = 0; @@ -755,7 +756,6 @@ cRecordings::~cRecordings() { Cancel(3); - free(updateFileName); } void cRecordings::Action(void) @@ -763,6 +763,13 @@ Refresh(); } +const char *cRecordings::UpdateFileName(void) +{ + if (!updateFileName) + updateFileName = strdup(AddDirectory(VideoDirectory, ".update")); + return updateFileName; +} + void cRecordings::Refresh(bool Foreground) { lastUpdate = time(NULL); // doing this first to make sure we don't miss anything @@ -825,13 +832,13 @@ void cRecordings::TouchUpdate(void) { - TouchFile(updateFileName); + TouchFile(UpdateFileName()); lastUpdate = time(NULL); // make sure we don't tigger ourselves } bool cRecordings::NeedsUpdate(void) { - return lastUpdate < LastModifiedTime(updateFileName); + return lastUpdate < LastModifiedTime(UpdateFileName()); } bool cRecordings::Update(bool Wait)