]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
define am_guest_unpriv
authorSerge Hallyn <shallyn@cisco.com>
Thu, 8 Feb 2018 18:06:39 +0000 (12:06 -0600)
committerSerge Hallyn <shallyn@cisco.com>
Thu, 8 Feb 2018 18:06:39 +0000 (12:06 -0600)
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: Serge Hallyn <shallyn@cisco.com>
src/lxc/utils.h

index 4d129d137ff68307daac51bc1fecdf11c619f32c..048995475603ec6d674c9c22cdd930c16e972e61 100644 (file)
@@ -435,6 +435,12 @@ extern int lxc_strmunmap(void *addr, size_t length);
 /* initialize rand with urandom */
 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)
 {
        FILE *f;