Merge pull request #3739 from jeckersb/nice-unsafe-nit

nice: Move call to Errno::clear() outside of unsafe block
This commit is contained in:
Sylvestre Ledru 2022-07-22 13:27:28 +02:00 committed by GitHub
commit 9a1b4b537a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -37,10 +37,8 @@ const USAGE: &str = "{} [OPTIONS] [COMMAND [ARGS]]";
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let matches = uu_app().try_get_matches_from(args).with_exit_code(125)?;
let mut niceness = unsafe {
nix::errno::Errno::clear();
libc::getpriority(PRIO_PROCESS, 0)
};
nix::errno::Errno::clear();
let mut niceness = unsafe { libc::getpriority(PRIO_PROCESS, 0) };
if Error::last_os_error().raw_os_error().unwrap() != 0 {
return Err(USimpleError::new(
125,