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

Add getresuid() and getresgid() to unistd #1430

Merged
merged 1 commit into from
May 31, 2021

Conversation

jerylvaz
Copy link
Contributor

No description provided.

src/unistd.rs Outdated Show resolved Hide resolved
src/unistd.rs Show resolved Hide resolved
src/unistd.rs Outdated Show resolved Hide resolved
src/unistd.rs Outdated Show resolved Hide resolved
test/test_unistd.rs Outdated Show resolved Hide resolved
test/test_unistd.rs Outdated Show resolved Hide resolved
@jerylvaz jerylvaz force-pushed the getresuid-getresgid branch 5 times, most recently from 3971a9b to 43e074e Compare April 24, 2021 11:39
@jerylvaz
Copy link
Contributor Author

@asomers What should be done with the unrelated test failure?

src/unistd.rs Outdated Show resolved Hide resolved
src/unistd.rs Outdated
/// - `Err(x)`: libc error code on failure.
///
#[inline]
pub fn getresuid() -> Result<(Uid, Uid, Uid)> {
Copy link
Member

Choose a reason for hiding this comment

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

Returning a tuple is a very old fashioned and failure-prone technique. Better to return a structure. That way the meaning is obvious even without consulting the documentation. Something like:

struct ResUid {
    real: Uid,
    effective: Uid,
    saved: uid
}

@jerylvaz jerylvaz force-pushed the getresuid-getresgid branch 2 times, most recently from 9450b0b to ae59760 Compare May 26, 2021 14:29
@asomers
Copy link
Member

asomers commented May 30, 2021

Looks good, but you'll have to rebase to fix the CI failure on FreeBSD.

@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/).

## [Unreleased] - ReleaseDate
### Added
Copy link
Member

Choose a reason for hiding this comment

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

Please fix the CHANGELOG. There was a merge error, and now there are two "Added" sections.

Copy link
Member

@asomers asomers left a comment

Choose a reason for hiding this comment

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

bors r+

@bors bors bot merged commit 478db7d into nix-rust:master May 31, 2021
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.

None yet

2 participants