Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: broken epg.data file ?



Henning Holtschneider wrote:
> 
> ----- Original Message -----
> From: "Klaus Schmidinger" <Klaus.Schmidinger@cadsoft.de>
> To: <vdr@linuxtv.org>
> Sent: Saturday, April 06, 2002 1:43 PM
> Subject: [vdr] Re: broken epg.data file ?
> 
> > This file is not complete. It is missing the closing 'e' and 'c'
> > tags, and especially the '\n' in the last line. This causes the
> > "while (<>)" loops to wait indefinitely until the line is actually
> > closed.
> > [...]
> > I'll change the code that writes this file so that it makes sure that
> > the file is only accessible after it has been written entirely:
> 
> What happens if VDR tries to read such an incomplete file? Will it hang,
> too? A couple of days ago, my /video disk ran out of free space. Since all
> recordings had the same priority, nothing got deleted. The EPG scan filled
> up the remaining space on the file system. I didn't notice the lack of space
> at first and when I restarted VDR, it hang while reading the incomplete
> epg.data file ...

You're right, VDR would also choke on such a file.

Here's a fix:

--- eit.c       2002/04/06 11:42:47     1.43
+++ eit.c       2002/04/06 13:58:59
@@ -390,12 +390,12 @@
              case 'e': pEvent = NULL;
                        break;
              case 'c': // to keep things simple we react on 'c' here
-                       return false;
+                       return true;
              default:  esyslog(LOG_ERR, "ERROR: unexpected tag while reading EPG data: %s", s);
                        return false;
              }
            }
-     return true;
+     esyslog(LOG_ERR, "ERROR: unexpected end of file while reading EPG data");
      }
   return false;
 }
@@ -754,8 +754,8 @@
               if (1 == sscanf(s + 1, "%u", &uServiceID)) {
                  cSchedule *p = (cSchedule *)Schedules->SetCurrentServiceID(uServiceID);
                  if (p) {
-                    while (cEventInfo::Read(f, p))
-                          ; // loop stops after having read the closing 'c'
+                    if (!cEventInfo::Read(f, p))
+                       return false;
                     }
                  }
               }

Klaus
-- 
_______________________________________________________________

Klaus Schmidinger                       Phone: +49-8635-6989-10
CadSoft Computer GmbH                   Fax:   +49-8635-6989-40
Hofmark 2                               Email:   kls@cadsoft.de
D-84568 Pleiskirchen, Germany           URL:     www.cadsoft.de
_______________________________________________________________



Home | Main Index | Thread Index