X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Frpm-fake.c;fp=src%2Frpm-fake.c;h=dbb4b4c12e23762cd6c823d7f6a1b8c09dd04edd;hb=bea242e7bfd39989a3a748aea2577f831986fcbf;hp=e19fe889cb51954c38c22c34c5cd1d830e56a5f5;hpb=c1f92799a23f22f43e7d705d8548d00975ee54ce;p=util-vserver.git 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) { /*...*/} + } } } }