From 84300455fc74a93728ee83da7d75d805ca01ac71 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Mon, 4 Jul 2005 22:36:46 +0000 Subject: [PATCH] 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 --- util-vserver/src/vserver-info.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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); -- 1.8.1.5