diff --git a/src/uu/mv/src/mv.rs b/src/uu/mv/src/mv.rs index d92762a8367..b2d34fdc8e9 100644 --- a/src/uu/mv/src/mv.rs +++ b/src/uu/mv/src/mv.rs @@ -23,8 +23,7 @@ use uucore::backup_control::{self, source_is_target_backup, BackupMode}; use uucore::display::Quotable; use uucore::error::{set_exit_code, FromIo, UError, UResult, USimpleError, UUsageError}; use uucore::fs::{are_hardlinks_or_one_way_symlink_to_same_file, are_hardlinks_to_same_file}; -#[cfg(unix)] -use uucore::libc::{EDQUOT, EEXIST, EISDIR, EMLINK, ENOSPC, ENOTEMPTY, ETXTBSY}; +use uucore::libc; use uucore::update_control::{self, UpdateMode}; use uucore::{format_usage, help_about, help_section, help_usage, prompt_yes, show}; @@ -402,8 +401,15 @@ fn move_files_into_dir(files: &[PathBuf], target_dir: &Path, b: &Behavior) -> UR Err(e) if e.to_string().is_empty() => set_exit_code(1), Err(e) => { match e.raw_os_error() { - #[cfg(unix)] - Some(ENOTEMPTY | EEXIST | EDQUOT | EISDIR | ENOSPC | EMLINK | ETXTBSY) => { + Some( + libc::ENOTEMPTY + | libc::EEXIST + | libc::EDQUOT + | libc::EISDIR + | libc::ENOSPC + | libc::EMLINK + | libc::ETXTBSY, + ) => { // The error message was changed to match GNU's decision // when an issue was filed. These will match when merged upstream. let e = e @@ -498,7 +504,7 @@ fn rename( } else { // TODO: change when 'io::Error::DirectoryNotEmpty' is stabilized. // https://github.com/rust-lang/rust/issues/86442 - return Err(io::Error::from_raw_os_error(ENOTEMPTY)); + return Err(io::Error::from_raw_os_error(libc::ENOTEMPTY)); } } }