[PATCH] tstream: Make socketpair nonblocking

Stefan (metze) Metzmacher metze at samba.org
Fri Jun 5 01:47:08 MDT 2015


Am 04.06.2015 um 01:42 schrieb Jeremy Allison:
> On Wed, Jun 03, 2015 at 04:06:10PM -0700, Christof Schmitt wrote:
>> On Wed, Jun 03, 2015 at 09:25:58AM -0700, Jeremy Allison wrote:
>>> On Wed, Jun 03, 2015 at 04:43:43PM +0200, Volker Lendecke wrote:
>>>> Hi!
>>>>
>>>> According to https://bugzilla.samba.org/show_bug.cgi?id=11061#c20 this
>>>> *MIGHT* also fix that bug.
>>>>
>>>> Volker
>>>
>>> Now that is a really *interesting* fix ! However did you find
>>> that ? Customer with 1000+ shares ? :-).
>>>
>>> Reviewed-by: Jeremy Allison <jra at samba.org>
>>>
>>> + pushed.
>>
>> Actually, 600 shares is sufficient to trigger this problem :-)
>>
>> I opened a bugzilla to backport this patch. Can you include
>> BUG: https://bugzilla.samba.org/show_bug.cgi?id=11312
>> before pushing again?
> 
> Will do if the autobuild fails again. It seems to be
> failing randomly (has done a couple of times today)
> in areas not related to this change.

Should we push the following on top?

metze
-------------- next part --------------
From d01c4bc95e63cc56a6f7dd2ccdaabf5d21855de8 Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Fri, 5 Jun 2015 09:40:19 +0200
Subject: [PATCH] libcli/named_pipe_auth: call smb_set_close_on_exec() in
 tstream_npa_socketpair()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11312

Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
 libcli/named_pipe_auth/npa_tstream.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/libcli/named_pipe_auth/npa_tstream.c b/libcli/named_pipe_auth/npa_tstream.c
index 3539202..20ae3de 100644
--- a/libcli/named_pipe_auth/npa_tstream.c
+++ b/libcli/named_pipe_auth/npa_tstream.c
@@ -1460,6 +1460,7 @@ int _tstream_npa_socketpair(uint16_t file_type,
 	int fd1;
 	int fd2;
 	int rc;
+	bool ok;
 
 	rc = socketpair(AF_UNIX, SOCK_STREAM, 0, fds);
 	if (rc == -1) {
@@ -1468,6 +1469,16 @@ int _tstream_npa_socketpair(uint16_t file_type,
 	fd1 = fds[0];
 	fd2 = fds[1];
 
+	ok = smb_set_close_on_exec(fd1);
+	if (!ok) {
+		goto close_fail;
+	}
+
+	ok = smb_set_close_on_exec(fd2);
+	if (!ok) {
+		goto close_fail;
+	}
+
 	rc = set_blocking(fd1, false);
 	if (rc == -1) {
 		goto close_fail;
-- 
1.9.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20150605/c10d09b5/attachment.pgp>


More information about the samba-technical mailing list