1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-08-01 21:47:46 +00:00

Merge pull request #1160 from uutils/revert-1159-utils_redox

Revert "Build hashsum, join, ln, ls, mkdir, mktemp, nl, ptx, sort on Redox"
This commit is contained in:
Jeremy Soller 2018-03-14 17:02:04 -06:00 committed by GitHub
commit 8af232c727
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 17 deletions

View file

@ -65,10 +65,19 @@ fuchsia = [
]
generic = [
"arch",
"hashsum",
"hostname",
"join",
"more",
"ln",
"ls",
"mkdir",
"mktemp",
"nl",
"nproc",
"ptx",
"shred",
"sort",
"sync",
"tail",
"test",
@ -102,21 +111,13 @@ redox_generic = [
"false",
"fmt",
"fold",
"hashsum",
"head",
"join",
"link",
"ln",
"ls",
"mkdir",
"mktemp",
"mv",
"nl",
"od",
"paste",
"printenv",
"printf",
"ptx",
"pwd",
"readlink",
"realpath",
@ -126,7 +127,6 @@ redox_generic = [
"seq",
"shuf",
"sleep",
"sort",
"split",
"sum",
"tac",

View file

@ -14,7 +14,7 @@ extern crate uucore;
use std::fs;
use std::io::{stdin, BufRead, BufReader, Result};
#[cfg(any(unix, target_os = "redox"))]
#[cfg(unix)]
use std::os::unix::fs::symlink;
#[cfg(windows)]
use std::os::windows::fs::{symlink_dir, symlink_file};

View file

@ -135,18 +135,20 @@ fn mkdir(path: &Path, mode: u16, verbose: bool) -> i32 {
show_info!("created directory '{}'", path.display());
}
#[cfg(any(unix, target_os = "redox"))]
#[cfg(unix)]
fn chmod(path: &Path, mode: u16) -> i32 {
use fs::{Permissions, set_permissions};
use std::os::unix::fs::{PermissionsExt};
use std::ffi::CString;
use std::io::Error;
let mode = Permissions::from_mode(mode as u32);
let directory =
CString::new(path.as_os_str().to_str().unwrap()).unwrap_or_else(|e| crash!(1, "{}", e));
let mode = mode as libc::mode_t;
if let Err(err) = set_permissions(path, mode) {
if unsafe { libc::chmod(directory.as_ptr(), mode) } != 0 {
show_info!(
"{}: error {}",
"{}: errno {}",
path.display(),
err
Error::last_os_error().raw_os_error().unwrap()
);
return 1;
}