Suppress error messages when reading extended attributes from a mounted filesystem that does not support extended attributes.

This solves #1303.
This commit is contained in:
Kenneth Skovhede
2015-03-04 16:53:40 +01:00
parent a57494ec65
commit 32ffc76815
3 changed files with 12 additions and 3 deletions
+5 -3
View File
@@ -173,10 +173,12 @@ namespace Duplicati.Library.Snapshots
public Dictionary<string, string> GetMetadata(string file)
{
var f = file.EndsWith(DIR_SEP) ? file.Substring(0, file.Length - 1) : file;
var n = UnixSupport.File.GetExtendedAttributes(f);
var dict = new Dictionary<string, string>();
foreach(var x in n)
dict["unix-ext:" + x.Key] = Convert.ToBase64String(x.Value);
var n = UnixSupport.File.GetExtendedAttributes(f);
if (n != null)
foreach(var x in n)
dict["unix-ext:" + x.Key] = Convert.ToBase64String(x.Value);
var fse = UnixSupport.File.GetUserGroupAndPermissions(f);
dict["unix:uid-gid-perm"] = string.Format("{0}-{1}-{2}", fse.UID, fse.GID, fse.Permissions);
+7
View File
@@ -190,7 +190,14 @@ namespace UnixSupport
string[] values;
var size = SUPPORTS_LLISTXATTR ? Mono.Unix.Native.Syscall.llistxattr(path, out values) : Mono.Unix.Native.Syscall.listxattr(path, out values);
if (size < 0)
{
// In case the underlying filesystem does not support extended attributes,
// we simply return that there are no attributes
if (Syscall.GetLastError() == Errno.EOPNOTSUPP)
return null;
throw new FileAccesException(path, "llistxattr");
}
var dict = new Dictionary<string, byte[]>();
foreach(var s in values)
Binary file not shown.