Skip to content

Commit

Permalink
Make mythcommflag terminate early on 0-byte files
Browse files Browse the repository at this point in the history
I had a rash of 0-byte files the other day, and I found that mythcommflag
would sit and spin trying to create some initial buffers, or something along
those lines.  This change makes it check if the file is 0 bytes.  If it is,
it will immediately quit with an error, rather than indefinitely try to
grind on it.

This may need some tweaking to deal with commflagging while recording as it
could cause a race condition if the file has no data at the moment that
mythcommflag starts.
  • Loading branch information
Beirdo committed Mar 10, 2011
1 parent e70c3ae commit 61f07e0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions mythtv/programs/mythcommflag/main.cpp
Expand Up @@ -752,6 +752,15 @@ static int FlagCommercials(

QString filename = get_filename(program_info);

QFile file(filename);
if (file.size() == 0)
{
VERBOSE(VB_IMPORTANT, QString("File %1 is zero-byte, aborting.")
.arg(filename));
global_program_info = NULL;
return GENERIC_EXIT_PERMISSIONS_ERROR;
}

RingBuffer *tmprbuf = RingBuffer::Create(filename, false);
if (!tmprbuf)
{
Expand Down

0 comments on commit 61f07e0

Please sign in to comment.