mirror of
https://github.com/Sonarr/Sonarr
synced 2025-12-15 21:03:56 +01:00
Return maximum long value on overflow getting disk information
Closes #8130
This commit is contained in:
parent
550cf8d399
commit
31a5a32356
1 changed files with 35 additions and 3 deletions
|
|
@ -1,12 +1,16 @@
|
||||||
using System.IO;
|
using System;
|
||||||
|
using System.IO;
|
||||||
using Mono.Unix;
|
using Mono.Unix;
|
||||||
|
using NLog;
|
||||||
using NzbDrone.Common.Disk;
|
using NzbDrone.Common.Disk;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
|
using NzbDrone.Common.Instrumentation;
|
||||||
|
|
||||||
namespace NzbDrone.Mono.Disk
|
namespace NzbDrone.Mono.Disk
|
||||||
{
|
{
|
||||||
public class ProcMount : IMount
|
public class ProcMount : IMount
|
||||||
{
|
{
|
||||||
|
private static readonly Logger Logger = NzbDroneLogger.GetLogger(typeof(ProcMount));
|
||||||
private readonly UnixDriveInfo _unixDriveInfo;
|
private readonly UnixDriveInfo _unixDriveInfo;
|
||||||
|
|
||||||
public ProcMount(DriveType driveType, string name, string mount, string type, MountOptions mountOptions)
|
public ProcMount(DriveType driveType, string name, string mount, string type, MountOptions mountOptions)
|
||||||
|
|
@ -34,9 +38,37 @@ public ProcMount(DriveType driveType, string name, string mount, string type, Mo
|
||||||
|
|
||||||
public string RootDirectory { get; private set; }
|
public string RootDirectory { get; private set; }
|
||||||
|
|
||||||
public long TotalFreeSpace => _unixDriveInfo.TotalFreeSpace;
|
public long TotalFreeSpace
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return _unixDriveInfo.TotalFreeSpace;
|
||||||
|
}
|
||||||
|
catch (OverflowException ex)
|
||||||
|
{
|
||||||
|
Logger.Warn(ex, "Failed to get total free space");
|
||||||
|
return long.MaxValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public long TotalSize => _unixDriveInfo.TotalSize;
|
public long TotalSize
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return _unixDriveInfo.TotalSize;
|
||||||
|
}
|
||||||
|
catch (OverflowException ex)
|
||||||
|
{
|
||||||
|
Logger.Warn(ex, "Failed to get total size");
|
||||||
|
return long.MaxValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public string VolumeLabel => _unixDriveInfo.VolumeLabel;
|
public string VolumeLabel => _unixDriveInfo.VolumeLabel;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue