Skip to content

Commit 0fa097f

Browse files
committed
merge branch 'pr-2481'
Tianjia Zhang (1): nsenter: fix repeat close() operations LGTMs: @kolyshkin @cyphar Closes #2481
2 parents dff7685 + 04806ab commit 0fa097f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

libcontainer/nsenter/nsexec.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -714,12 +714,12 @@ void nsexec(void)
714714
* ready, so we can receive all possible error codes
715715
* generated by children.
716716
*/
717+
syncfd = sync_child_pipe[1];
718+
close(sync_child_pipe[0]);
719+
717720
while (!ready) {
718721
enum sync_t s;
719722

720-
syncfd = sync_child_pipe[1];
721-
close(sync_child_pipe[0]);
722-
723723
if (read(syncfd, &s, sizeof(s)) != sizeof(s))
724724
bail("failed to sync with child: next state");
725725

@@ -789,13 +789,13 @@ void nsexec(void)
789789

790790
/* Now sync with grandchild. */
791791

792+
syncfd = sync_grandchild_pipe[1];
793+
close(sync_grandchild_pipe[0]);
794+
792795
ready = false;
793796
while (!ready) {
794797
enum sync_t s;
795798

796-
syncfd = sync_grandchild_pipe[1];
797-
close(sync_grandchild_pipe[0]);
798-
799799
s = SYNC_GRANDCHILD;
800800
if (write(syncfd, &s, sizeof(s)) != sizeof(s)) {
801801
kill(child, SIGKILL);

0 commit comments

Comments
 (0)