Fixed calculating the disk use percentage if there's more than 20TB of recordings

This commit is contained in:
Klaus Schmidinger 2021-12-27 11:20:35 +01:00
parent a16a451c1f
commit 2dc383d362
3 changed files with 8 additions and 2 deletions

View File

@ -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

View File

@ -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).

View File

@ -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)