Skip to content

Commit

Permalink
merge branch 'pr-2481'
Browse files Browse the repository at this point in the history
Tianjia Zhang (1):
  nsenter: fix repeat close() operations

LGTMs: @kolyshkin @cyphar
Closes #2481
  • Loading branch information
cyphar committed Jun 20, 2020
2 parents dff7685 + 04806ab commit 0fa097f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions libcontainer/nsenter/nsexec.c
Original file line number Diff line number Diff line change
Expand Up @@ -714,12 +714,12 @@ void nsexec(void)
* ready, so we can receive all possible error codes
* generated by children.
*/
syncfd = sync_child_pipe[1];
close(sync_child_pipe[0]);

while (!ready) {
enum sync_t s;

syncfd = sync_child_pipe[1];
close(sync_child_pipe[0]);

if (read(syncfd, &s, sizeof(s)) != sizeof(s))
bail("failed to sync with child: next state");

Expand Down Expand Up @@ -789,13 +789,13 @@ void nsexec(void)

/* Now sync with grandchild. */

syncfd = sync_grandchild_pipe[1];
close(sync_grandchild_pipe[0]);

ready = false;
while (!ready) {
enum sync_t s;

syncfd = sync_grandchild_pipe[1];
close(sync_grandchild_pipe[0]);

s = SYNC_GRANDCHILD;
if (write(syncfd, &s, sizeof(s)) != sizeof(s)) {
kill(child, SIGKILL);
Expand Down

0 comments on commit 0fa097f

Please sign in to comment.