Hopefully this will make it bullet-proof.
authorDaniel Hokka Zakrisson <daniel@hozac.com>
Sun, 20 Jan 2008 08:01:17 +0000 (08:01 +0000)
committerDaniel Hokka Zakrisson <daniel@hozac.com>
Sun, 20 Jan 2008 08:01:17 +0000 (08:01 +0000)
git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@2665 94cd875c-1c1d-0410-91d2-eb244daf1a30

src/rpm-fake.c

index b0ce156..e19fe88 100644 (file)
@@ -510,8 +510,13 @@ exitRPMFake()
     uint8_t    c;
     if (read(sync_sock, &c, 1)!=1) { /*...*/ }
     if (write(pw_sock, "Q", 1)!=1) { /*...*/ }
-    /* sync_sock should return EOF when the resolver exits... */
-    if (read(sync_sock, &c, 1)!=0) { /*...*/ }
+    if (vc_isSupported(vcFEATURE_VWAIT)) {
+      if (vc_wait_exit(ctx)==-1) { /*...*/ }
+    }
+    else {
+      /* this can race */
+      if (read(sync_sock, &c, 1)!=0) { /*...*/}
+    }
   }
 }