Permalink
Browse files

Correct 32-bit false positive autoexpiration when free space is >2TB.

This corrects the symtomatic instances of improper typing in the
autoexpiration code.  The total free space (in KB) is cast from a
64-bit+ long long, to a size_t which varies depending on architecture.
When compiled on a 32-bit system, this unsafe casting results in an
inversion of the conditional every 2TB of freespace.  At 0-2TB free, or
4-6TB free, everything works properly.  At 2-4TB or 6-8TB free, it
immediately deletes anything it can.
  • Loading branch information...
1 parent e4660d6 commit 10d562420ca1b61fb1d6206547cb3ea7e76830ab @wagnerrp wagnerrp committed Jan 26, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 mythtv/programs/mythbackend/autoexpire.cpp
@@ -464,7 +464,7 @@ void AutoExpire::ExpireRecordings(void)
continue;
}
- if ((size_t)max(0LL, fsit->freeSpaceKB) < desired_space[fsit->fsID])
+ if ((int64_t)max(0LL, fsit->freeSpaceKB) < desired_space[fsit->fsID])
{
VERBOSE(VB_FILE,
QString(" Not Enough Free Space! We want %1 MB")
@@ -491,7 +491,7 @@ void AutoExpire::ExpireRecordings(void)
QString myHostName = gCoreContext->GetHostName();
pginfolist_t::iterator it = expireList.begin();
while ((it != expireList.end()) &&
- ((size_t)max(0LL, fsit->freeSpaceKB) < desired_space[fsit->fsID]))
+ ((int64_t)max(0LL, fsit->freeSpaceKB) < desired_space[fsit->fsID]))
{
ProgramInfo *p = *it;
it++;

0 comments on commit 10d5624

Please sign in to comment.