From: Enrico Scholz Date: Mon, 4 Jul 2005 22:36:46 +0000 (+0000) Subject: allow to pass a numeric xid to 'vserver-info ... RUNNING' X-Git-Tag: version_0_30_210~138 X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=84300455fc74a93728ee83da7d75d805ca01ac71;p=util-vserver.git allow to pass a numeric xid to 'vserver-info ... RUNNING' git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@2143 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- diff --git a/util-vserver/src/vserver-info.c b/util-vserver/src/vserver-info.c index cbc8ba9..ea62b55 100644 --- a/util-vserver/src/vserver-info.c +++ b/util-vserver/src/vserver-info.c @@ -488,9 +488,17 @@ execQuery(char const *vserver, VserverTag tag, int argc, char *argv[]) res = vc_getVserverAppDir(vserver, vcCFG_AUTO, argc==0 ? "" : argv[0]); break; - case tgRUNNING : - res = (vc_getVserverCtx(vserver, vcCFG_AUTO, false, 0)==VC_NOCTX) ? 0 : "1"; + case tgRUNNING : { + signed long xid; // type is a small hack, but should be ok... + struct vc_vx_info info; + + if (isNumber(vserver, &xid) && xid>=0) + res = (vc_get_vx_info(xid, &info)==-1) ? 0 : "1"; + else + res = (vc_getVserverCtx(vserver, vcCFG_AUTO, false, 0)==VC_NOCTX) ? 0 : "1"; + break; + } case tgCANONIFY : strcpy(buf, vserver);