summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2021-12-27 11:20:35 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2021-12-27 11:20:35 +0100
commit2dc383d362fbc900c89bfa309c2ca145e50a3ca9 (patch)
treeeb1bdd9889a21d2ce68e774edcdfdaac88e186e6
parenta16a451c1f411b223066209ff7cd840f40c7757c (diff)
downloadvdr-2dc383d362fbc900c89bfa309c2ca145e50a3ca9.tar.gz
vdr-2dc383d362fbc900c89bfa309c2ca145e50a3ca9.tar.bz2
Fixed calculating the disk use percentage if there's more than 20TB of recordings
-rw-r--r--CONTRIBUTORS4
-rw-r--r--HISTORY2
-rw-r--r--videodir.c4
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 <Jens.Schleusener@fossies.org>
Bernd Kuhls <bernd.kuhls@t-online.de>
for fixing possible compilation errors with libjpeg
+
+Timo Weingärtner <timo@tiwe.de>
+ 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)