X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fvserver-stat.c;h=9a9e7ee43cd43e0468538b335c13625159734e17;hb=484920dab2064a18ca00f7b3335ae0417c8b4034;hp=efb87063f861764f46c27625f575d8e0e76c82d7;hpb=fc84d2d3d5179f3bbbcee0f7e8d8cb155239edfd;p=util-vserver.git diff --git a/src/vserver-stat.c b/src/vserver-stat.c index efb8706..9a9e7ee 100644 --- a/src/vserver-stat.c +++ b/src/vserver-stat.c @@ -613,19 +613,6 @@ int main(int argc, char **argv) if (hertz==0x42) initHertz(); if (pagesize==0x42) initPageSize(); - my_pid = getpid(); - - if (!switchToWatchXid(&errptr)) { - perror(errptr); - exit(1); - } - - if (access("/proc/uptime",R_OK)==-1 && errno==ENOENT) - WRITE_MSG(2, - "WARNING: can not access /proc/uptime. Usually, this is caused by\n" - " procfs-security. Please read the FAQ for more details\n" - " http://linux-vserver.org/Proc-Security\n"); - Vector_init(&xid_data, sizeof(struct XidData)); if (vc_isSupported(vcFEATURE_VSTAT)) { @@ -641,6 +628,19 @@ int main(int argc, char **argv) closedir(proc_dir); } else { + my_pid = getpid(); + + if (!switchToWatchXid(&errptr)) { + perror(errptr); + exit(1); + } + + if (access("/proc/uptime",R_OK)==-1 && errno==ENOENT) + WRITE_MSG(2, + "WARNING: can not access /proc/uptime. Usually, this is caused by\n" + " procfs-security. Please read the FAQ for more details\n" + " http://linux-vserver.org/Proc-Security\n"); + Echdir(PROC_DIR_NAME); proc_dir = Eopendir("."); while ((dir_entry = readdir(proc_dir)) != NULL)