summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Wagner <rwagner@mythtv.org>2012-01-26 21:47:41 (GMT)
committer Raymond Wagner <rwagner@mythtv.org>2012-01-26 21:47:41 (GMT)
commit10d562420ca1b61fb1d6206547cb3ea7e76830ab (patch)
treedd185d0a32558780e8a8eb59bad65c96aeb96182
parente4660d6e67ec20ba5f6774738601d9ab992fb9e4 (diff)
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.
-rw-r--r--mythtv/programs/mythbackend/autoexpire.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/mythtv/programs/mythbackend/autoexpire.cpp b/mythtv/programs/mythbackend/autoexpire.cpp
index ab975e9..d71fb2b 100644
--- a/mythtv/programs/mythbackend/autoexpire.cpp
+++ b/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++;