allow to pass a numeric xid to 'vserver-info ... RUNNING'
authorEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Mon, 4 Jul 2005 22:36:46 +0000 (22:36 +0000)
committerEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Mon, 4 Jul 2005 22:36:46 +0000 (22:36 +0000)
git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@2143 94cd875c-1c1d-0410-91d2-eb244daf1a30

util-vserver/src/vserver-info.c

index cbc8ba9..ea62b55 100644 (file)
@@ -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);