From 360e68a7939a60b68205ef3303433b040399825b Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Sun, 14 Jun 2020 14:55:27 +0200 Subject: [PATCH] Remove stacktrace if hardlink resulted in EXDEV. Signed-off-by: Robin Dadswell --- src/NzbDrone.Mono/Disk/DiskProvider.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Mono/Disk/DiskProvider.cs b/src/NzbDrone.Mono/Disk/DiskProvider.cs index b6da9ac0c..2172cbc01 100644 --- a/src/NzbDrone.Mono/Disk/DiskProvider.cs +++ b/src/NzbDrone.Mono/Disk/DiskProvider.cs @@ -424,9 +424,22 @@ public override bool TryCreateHardLink(string source, string destination) fileInfo.CreateLink(destination); return true; } + catch (UnixIOException ex) + { + if (ex.ErrorCode == Errno.EXDEV) + { + _logger.Trace("Hardlink '{0}' to '{1}' failed due to cross-device access.", source, destination); + } + else + { + _logger.Debug(ex, "Hardlink '{0}' to '{1}' failed.", source, destination); + } + + return false; + } catch (Exception ex) { - Logger.Debug(ex, string.Format("Hardlink '{0}' to '{1}' failed.", source, destination)); + _logger.Debug(ex, "Hardlink '{0}' to '{1}' failed.", source, destination); return false; } }