forked from canonical/snapd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/libsnap-confine-private/tool: switch identity only after forking …
…a child (canonical#15100) * cmd/libsnap-confine-private: tweak sc_identity to use bool fields Switch sc_identity change_{uid,gid} to use bools, such that it's clearer that those fields are not carrying actual uid/gid but only dictate the action to be taken. Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com> * cmd/libsnap-confine-private/tool: switch identity only after forking a child We had a recurring pattern of switching the identity, then calling a tool, followed by restoring the old identity. Since the tool is called in a forked child process anyway, there is no clear win to switch the identity in the parent process, which then requires a followup restore operation. Move switching of identity to the child process, this simplifying the code path. Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com> --------- Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>
- Loading branch information
Showing
2 changed files
with
29 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters