[PATCH] smbtorture: Close unused pipe fds in kernel_oplocks8

Christof Schmitt cs at samba.org
Thu Nov 15 18:18:08 UTC 2018


Found this while doing some manual testing. A wrong path for localdir in
the smb2.kernel_oplocks8 test leads to a smbtorture hang.

Christof
-------------- next part --------------
From 5dfddc51fd8ae073d2bff68ed26dce590333e7ce Mon Sep 17 00:00:00 2001
From: Christof Schmitt <cs at samba.org>
Date: Wed, 14 Nov 2018 15:13:03 -0700
Subject: [PATCH] smbtorture: Close unused pipe fds in kernel_oplocks8

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 at samba.org>
---
 source4/torture/smb2/oplock.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/source4/torture/smb2/oplock.c b/source4/torture/smb2/oplock.c
index 800a4cf299f..8bbb641ea72 100644
--- a/source4/torture/smb2/oplock.c
+++ b/source4/torture/smb2/oplock.c
@@ -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. */
-- 
2.17.0



More information about the samba-technical mailing list