Commit 477aa378 by Serge Hallyn

define am_guest_unpriv

Sometimes we want to know whether we are privileged wrt our namespaces, and sometimes we want to know whether we are priv wrt init_user_ns. Signed-off-by: 's avatarSerge Hallyn <shallyn@cisco.com>
parent 5596585d
...@@ -435,6 +435,12 @@ extern int lxc_strmunmap(void *addr, size_t length); ...@@ -435,6 +435,12 @@ extern int lxc_strmunmap(void *addr, size_t length);
/* initialize rand with urandom */ /* initialize rand with urandom */
extern int randseed(bool); extern int randseed(bool);
/* are we unprivileged with respect to our namespaces */
inline static bool am_guest_unpriv(void) {
return geteuid() != 0;
}
/* are we unprivileged with respect to init_user_ns */
inline static bool am_host_unpriv(void) inline static bool am_host_unpriv(void)
{ {
FILE *f; FILE *f;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment