From: Enrico Scholz Date: Wed, 7 Jan 2004 16:24:01 +0000 (+0000) Subject: backported from HEAD: X-Git-Tag: version_0_27_90~7 X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ae8c82931ff7e269c2e6171f247039b876fdccc7;p=util-vserver.git backported from HEAD: * removed obsolete and unused 'fakeinit' variable * fixed ctx-creation with fakeinit and static ctx-id's; fakeinit requires a second call for ctx -2 to take effect git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/branches/SYSCALL_SWITCH@557 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- diff --git a/util-vserver/src/chcontext.c b/util-vserver/src/chcontext.c index 5e4fc1b..13b044d 100644 --- a/util-vserver/src/chcontext.c +++ b/util-vserver/src/chcontext.c @@ -117,7 +117,6 @@ int main (int argc, char *argv[]) int nbctx = 0; int ctxs[16]; int disconnect = 0; - int fakeinit = 0; int silent = 0; int flags = 0; unsigned remove_cap = 0; @@ -164,7 +163,6 @@ int main (int argc, char *argv[]) }else if (strcmp(opt,"private")==0){ flags |= 8; }else if (strcmp(opt,"fakeinit")==0){ - fakeinit = 1; flags |= 16; }else if (strcmp(opt,"hideinfo")==0){ flags |= 32; @@ -257,8 +255,10 @@ int main (int argc, char *argv[]) */ if (disconnect == 0 || fork()==0){ int newctx; + int xflags = flags & 16; + if (nbctx == 0) ctxs[nbctx++] = -1; - newctx = vc_new_s_context(ctxs[0],0,flags); + newctx = vc_new_s_context(ctxs[0],0,flags&~16); if (newctx != -1){ if (hostname != NULL){ if (sethostname (hostname,strlen(hostname))==-1){ @@ -275,7 +275,8 @@ int main (int argc, char *argv[]) } } remove_cap &= (~add_cap); - if (remove_cap != 0) vc_new_s_context (-2,remove_cap,0); + if (remove_cap!=0 || xflags!=0) + vc_new_s_context (-2,remove_cap,xflags); if (!silent){ printf ("New security context is %d\n" ,ctxs[0] == -1 ? newctx : ctxs[0]);