xattr: cleanup: don't use pxar types in the API

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller
2020-04-24 11:14:43 +02:00
parent 27a3decbfe
commit 9094186a57
2 changed files with 30 additions and 58 deletions

View File

@ -341,12 +341,14 @@ impl<R: Read> SequentialDecoder<R> {
fcaps: &Option<PxarFCaps>,
) -> Result<(), Error> {
for xattr in xattrs {
if let Err(err) = xattr::fsetxattr(fd, &xattr) {
let name = CString::new(&xattr.name[..])
.map_err(|_| format_err!("invalid xattr name with zeroes"))?;
if let Err(err) = xattr::fsetxattr(fd, &name, &xattr.value) {
bail!("fsetxattr failed with error: {}", err);
}
}
if let Some(fcaps) = fcaps {
if let Err(err) = xattr::fsetxattr_fcaps(fd, &fcaps) {
if let Err(err) = xattr::fsetxattr_fcaps(fd, &fcaps.data) {
bail!("fsetxattr_fcaps failed with error: {}", err);
}
}