smbtorture: Close unused pipe fds in kernel_oplocks8
authorChristof Schmitt <cs@samba.org>
Wed, 14 Nov 2018 22:13:03 +0000 (15:13 -0700)
committerJeremy Allison <jra@samba.org>
Fri, 16 Nov 2018 20:52:13 +0000 (21:52 +0100)
This fixes a hang of the testcase when hitting an error in the child (e.g.
localdir does not exist)

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Nov 16 21:52:13 CET 2018 on sn-devel-144

source4/torture/smb2/oplock.c

index 800a4cf299f28459b193db116599dbb2fb3cb5f2..8bbb641ea72fceee76ad086c624927ff94297419 100644 (file)
@@ -4956,12 +4956,14 @@ static bool wait_for_child_oplock(struct torture_context *tctx,
                char c;
                /* Parent. */
                TALLOC_FREE(name);
+               close(fds[1]);
                ret = sys_read(fds[0], &c, 1);
                torture_assert(tctx, ret == 1, "read failed");
                return true;
        }
 
        /* Child process. */
+       close(fds[0]);
        ret = do_child_process(fds[1], name);
        _exit(ret);
        /* Notreached. */