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 EmptyPath for FchownatFlags #1128

Closed
wants to merge 1 commit into from

Conversation

tathanhdinh
Copy link
Contributor

Hello,

This PR is probably a fix for #1029. Thanks for any response.

@otavio
Copy link
Contributor

otavio commented Sep 25, 2019

Couldn't same thing to be done using fchown()?

@tathanhdinh
Copy link
Contributor Author

@otavio thank you for the feedback but IMHO fchown doesn't need flags.

@otavio
Copy link
Contributor

otavio commented Sep 26, 2019

@tathanhdinh you got me wrong. I meant if it is worth adding this or using the fchown as an alternative.

@tathanhdinh
Copy link
Contributor Author

tathanhdinh commented Sep 26, 2019

Sorry, I did misunderstand your remark.
I don't know whether fchown can always be used. Does it always follow symbolic link?

@otavio
Copy link
Contributor

otavio commented Sep 27, 2019

The fchown operates on the file description and in this case, seems equivalent to fchownat with EmptyPath flag.

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.

This is a good start, but it still needs:

  1. An explanation in fchownat's doc comment
  2. A test
  3. A CHANGELOG entry

Comment on lines 631 to +635
pub enum FchownatFlags {
FollowSymlink,
NoFollowSymlink,
#[cfg(target_os = "linux")]
EmptyPath,
Copy link
Member

Choose a reason for hiding this comment

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

If we add this flag, then this type should no longer be an enum but a bitflag cause you can do AT_EMPTY_PATH and AT_SYMLINK_NOFOLLOW at the same time

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

4 participants