From 2dc383d362fbc900c89bfa309c2ca145e50a3ca9 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Mon, 27 Dec 2021 11:20:35 +0100 Subject: Fixed calculating the disk use percentage if there's more than 20TB of recordings --- CONTRIBUTORS | 4 ++++ HISTORY | 2 ++ videodir.c | 4 ++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index b5fc4874..39e9c0e7 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -3674,3 +3674,7 @@ Jens Schleusener Bernd Kuhls for fixing possible compilation errors with libjpeg + +Timo Weingärtner + for reporting an integer overflow in calculating the disk use percentage if there's + more than 20TB of recordings diff --git a/HISTORY b/HISTORY index ac8d8799..9d7470a4 100644 --- a/HISTORY +++ b/HISTORY @@ -9583,3 +9583,5 @@ Video Disk Recorder Revision History Haubrich). - Fixed a memory leak in handling the NIT (thanks to Helmut Binder). - Fixed a possible memory leak in creating fonts (reported by Helmut Binder). +- Fixed calculating the disk use percentage if there's more than 20TB of recordings + (reported by Timo Weingärtner). diff --git a/videodir.c b/videodir.c index b2257fa6..f3515ebf 100644 --- a/videodir.c +++ b/videodir.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: videodir.c 4.1 2015/08/11 13:39:59 kls Exp $ + * $Id: videodir.c 4.1.1.1 2021/12/27 11:18:40 kls Exp $ */ #include "videodir.h" @@ -158,7 +158,7 @@ int cVideoDirectory::VideoDiskSpace(int *FreeMB, int *UsedMB) *FreeMB = free; if (UsedMB) *UsedMB = used; - return (free + used) ? used * 100 / (free + used) : 0; + return (free + used) ? round(double(used) * 100 / (free + used)) : 0; } cString cVideoDirectory::PrefixVideoFileName(const char *FileName, char Prefix) -- cgit v1.2.3