Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added direct support for fchown() and dup3() #960

Closed
wants to merge 2 commits into from
Closed

Added direct support for fchown() and dup3() #960

wants to merge 2 commits into from

Conversation

koutheir
Copy link

@koutheir koutheir commented Nov 1, 2018

  • Added direct support for dup3.
  • Removed emulation of dup3.
  • Added support for fchown.

Fixes #939.

@@ -30,10 +30,15 @@ This project adheres to [Semantic Versioning](http://semver.org/).
([#949](https://github.com/nix-rust/nix/pull/949)) ([#958](https://github.com/nix-rust/nix/pull/958))
- Added a `acct` wrapper module for enabling and disabling process accounting
([#952](https://github.com/nix-rust/nix/pull/952))
- Added a `fchown` wrapper.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a link to the PR here and below.

let (uid, gid) = chown_raw_ids(owner, group);
let res = unsafe { libc::fchown(fd, uid, gid) };

Errno::result(res).map(drop)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a matter of style, I prefer .map(|| ()). drop, in this case, is really just being used for its "side effect" of returning nothing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

unistd::dup3 never uses the dup3 syscall (even if it might be available)
2 participants