src/tools/xattr.rs: fix test when run as root
This commit is contained in:
parent
7773ccc11f
commit
44c54845b3
@ -159,7 +159,11 @@ mod tests {
|
|||||||
|
|
||||||
assert!(fsetxattr(fd, valid_user).is_ok());
|
assert!(fsetxattr(fd, valid_user).is_ok());
|
||||||
assert!(fsetxattr(fd, valid_empty_value).is_ok());
|
assert!(fsetxattr(fd, valid_empty_value).is_ok());
|
||||||
|
|
||||||
|
if nix::unistd::Uid::current() != nix::unistd::ROOT {
|
||||||
assert_eq!(fsetxattr(fd, invalid_trusted), Err(Errno::EPERM));
|
assert_eq!(fsetxattr(fd, invalid_trusted), Err(Errno::EPERM));
|
||||||
|
}
|
||||||
|
|
||||||
assert_eq!(fsetxattr(fd, invalid_name_prefix), Err(Errno::EOPNOTSUPP));
|
assert_eq!(fsetxattr(fd, invalid_name_prefix), Err(Errno::EOPNOTSUPP));
|
||||||
assert_eq!(fsetxattr(fd, invalid_name_length), Err(Errno::ERANGE));
|
assert_eq!(fsetxattr(fd, invalid_name_length), Err(Errno::ERANGE));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user