X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fshared%2Fvirt.c;h=eed321016d3ad6fe90567458569d9ea41a8c8e03;hb=076a24adf4bfbb9c5aa8167e102c253c7e1c651e;hp=6e447944967a115a2e7b0b596254a2d5d9bebc2f;hpb=ab94af9201496ea3aa59bbf2a01eb750fbd1c08a;p=elogind.git diff --git a/src/shared/virt.c b/src/shared/virt.c index 6e4479449..eed321016 100644 --- a/src/shared/virt.c +++ b/src/shared/virt.c @@ -25,6 +25,7 @@ #include "util.h" #include "virt.h" +#include "fileio.h" /* Returns a short identifier for the various VM implementations */ int detect_vm(const char **id) { @@ -159,10 +160,10 @@ int detect_container(const char **id) { /* Unfortunately many of these operations require root access * in one way or another */ - if (geteuid() != 0) - return -EPERM; - - if (running_in_chroot() > 0) { + r = running_in_chroot(); + if (r < 0) + return r; + if (r > 0) { if (id) *id = "chroot";