mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-30 08:51:04 +02:00
gui/infoviewer.cpp: fix crash, if s.f_blocks is 0
happens if network_nfs_recordingdir set to not mounted dir under tmp or media
Origin commit data
------------------
Branch: ni/coolstream
Commit: 36b80096b9
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2012-04-19 (Thu, 19 Apr 2012)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -1628,8 +1628,9 @@ void CInfoViewer::showSNR ()
|
|||||||
per = 0;
|
per = 0;
|
||||||
//HD info
|
//HD info
|
||||||
if(!check_dir(g_settings.network_nfs_recordingdir)) {
|
if(!check_dir(g_settings.network_nfs_recordingdir)) {
|
||||||
if (::statfs(g_settings.network_nfs_recordingdir, &s) == 0) {
|
if (::statfs(g_settings.network_nfs_recordingdir, &s) == 0 && s.f_blocks) {
|
||||||
per = (s.f_blocks - s.f_bfree) / (s.f_blocks/100);
|
long blocks_used = s.f_blocks - s.f_bfree;
|
||||||
|
per = (blocks_used * 100ULL) / s.f_blocks;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
hddscale->paintProgressBar(scale_x, BBarY + InfoHeightY_Info / 2 + 2, hddwidth, 6, per, 100);
|
hddscale->paintProgressBar(scale_x, BBarY + InfoHeightY_Info / 2 + 2, hddwidth, 6, per, 100);
|
||||||
|
Reference in New Issue
Block a user