xattr: api cleanup
Make `flistxattr()` return a `ListXAttr` helper which provides an iterator over `&CStr`. This exposes the property that xattr names are a zero-terminated string without simply being an opaque "byte vector". Using &[u8] as a type here is too lax. Also let `fgetxattr` take a `CStr`. While this may be a burden on the caller, we usually already have zero-terminated strings on the call site. Currently we only use this method coming from `flistxattr` after all. Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
@ -287,7 +287,7 @@ impl<'a, W: Write, C: BackupCatalogWriter> Encoder<'a, W, C> {
|
||||
Err(err) => bail!("read_xattrs failed for {:?} - {}", self.full_path(), err),
|
||||
};
|
||||
|
||||
for name in xattr_names.split(|c| *c == b'\0') {
|
||||
for name in &xattr_names {
|
||||
// Only extract the relevant extended attributes
|
||||
if !xattr::is_valid_xattr_name(&name) {
|
||||
continue;
|
||||
@ -307,7 +307,7 @@ impl<'a, W: Write, C: BackupCatalogWriter> Encoder<'a, W, C> {
|
||||
}
|
||||
} else if self.has_features(flags::WITH_XATTRS) {
|
||||
xattrs.push(PxarXAttr {
|
||||
name: name.to_vec(),
|
||||
name: name.to_bytes().to_vec(),
|
||||
value,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user