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:
@@ -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);
|
||||
|
||||
Vendored
+7
@@ -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)
|
||||
|
||||
BIN
Binary file not shown.
Reference in New Issue
Block a user