-
Notifications
You must be signed in to change notification settings - Fork 458
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
Inherit uds permissions when unlinking #113
Conversation
edgelet/edgelet-http/src/unix.rs
Outdated
|
||
debug!("settings permissions {:#o} for {}...", mode, path.as_ref().display()); | ||
let prev = umask(mask); | ||
defer! {{ umask(prev); }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am guessing this restores the current process's umask when this function returns? Nice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. It's similar to go's defer
. The macro creates a struct and implements Drop
and calls the block given to the macro in the drop
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool!
In the edgelet, when unlinking an existing unix domain socket, we use the umask of the process to create the new socket. This doesn't work well for the edgelet, because we need different permissions for the workload and mgmt sockets.
This PR updates the flow for the
unix
scheme to use the previous socket's mode when unlinking and creating the new socket.