From: Daniel Hokka Zakrisson Date: Sat, 9 Feb 2008 00:27:46 +0000 (+0000) Subject: We only want to wait on the context if we created it. X-Git-Tag: release-0.30.215~32 X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bea242e7bfd39989a3a748aea2577f831986fcbf;p=util-vserver.git We only want to wait on the context if we created it. git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@2675 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- diff --git a/src/rpm-fake.c b/src/rpm-fake.c index e19fe88..dbb4b4c 100644 --- a/src/rpm-fake.c +++ b/src/rpm-fake.c @@ -96,6 +96,8 @@ static unsigned int debug_level = 0; static bool is_initialized = false; +static bool ctx_created = false; + //DECLARE(rpm_execcon); //DECLARE(execv); DECLARE(getpwnam); @@ -270,6 +272,7 @@ setupContext(xid_t xid, char const **xid_str) xid = rc; res = true; + ctx_created = true; } } @@ -510,12 +513,14 @@ exitRPMFake() uint8_t c; if (read(sync_sock, &c, 1)!=1) { /*...*/ } if (write(pw_sock, "Q", 1)!=1) { /*...*/ } - if (vc_isSupported(vcFEATURE_VWAIT)) { - if (vc_wait_exit(ctx)==-1) { /*...*/ } - } - else { - /* this can race */ - if (read(sync_sock, &c, 1)!=0) { /*...*/} + if (ctx_created) { + if (vc_isSupported(vcFEATURE_VWAIT)) { + if (vc_wait_exit(ctx)==-1) { /*...*/ } + } + else { + /* this can race */ + if (read(sync_sock, &c, 1)!=0) { /*...*/} + } } } }