From owner-svn-src-all@freebsd.org Fri Nov 20 23:55:32 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3AAC0A33C90 for ; Fri, 20 Nov 2015 23:55:32 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com [209.85.217.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B93271C99 for ; Fri, 20 Nov 2015 23:55:31 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: by lbbcs9 with SMTP id cs9so70382893lbb.1 for ; Fri, 20 Nov 2015 15:55:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-type :content-transfer-encoding; bh=IDonGINNCxt7DZFxWdIEMXTENcuMJ50FChX0NMlT8f4=; b=MmJ7aofSuRUm90wwI9G84gaBBI+mYjCjKSTLRzK7Vlz0LrKPanyDdh6lzLuNjBvSBC 0G/MlGXqu0lRrS6vkcEXSq7EsIZpHt9WhZeYLZHKscpZ/ZcG5FnZUkn9oeVpej/axeHW ue1+88j1IItyQ46hQ6Xjg8tS+YlVRGtigHDwaOQz6Cl0sNXvx7oazBH1ArGTTh7KeGFl t4202Z0TX+DnHirDZpkqkZztn18qfvRX6hkqXf5eZSv74WrFfxN9nsdxVB2weQs6IyZt gnFg2MrUgPdrEuKCeNkiJ/3kyr5sUQ4ztLYzGTk0k/vmxMN6is3acviSwc2uNQXx0B3/ cp1w== X-Gm-Message-State: ALoCoQk15IPIKwcSwp15ZzHQHd9p3ILbPDnMCXycRrt60xDu/2hCt0QPvHzvpMqNVcmeS/8UpaXv X-Received: by 10.112.30.145 with SMTP id s17mr6768357lbh.75.1448063729737; Fri, 20 Nov 2015 15:55:29 -0800 (PST) Received: from [192.168.1.2] ([89.169.173.68]) by smtp.gmail.com with ESMTPSA id 93sm236642lfx.1.2015.11.20.15.55.28 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 20 Nov 2015 15:55:28 -0800 (PST) Subject: Re: svn commit: r291114 - head/lib/libc/gen To: Ravi Pokala , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201511202236.tAKMaf06048447@repo.freebsd.org> <564FAAB0.6000600@freebsd.org> From: Andrey Chernov X-Enigmail-Draft-Status: N1110 Message-ID: <564FB2EF.7020302@freebsd.org> Date: Sat, 21 Nov 2015 02:55:27 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <564FAAB0.6000600@freebsd.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Nov 2015 23:55:32 -0000 On 21.11.2015 2:20, Andrey Chernov wrote: > On 21.11.2015 1:36, Ravi Pokala wrote: >> Move fdopen() up near other resource allocation like malloc(); do proper >> deallocation on failure later on in the function. > > Incorrect. Old code calls fdopen() only in the parent, new one calls > fdopen() before fork(), so its results shared by both parent and child, > which is wrong for child() case. > To be specific, fdopen() may set FD_CLOEXEC for the _child_, for example. I don't have a time right now to check what happens in that case, but it looks suspicious. IMHO it will be better to add fdopen() error processing in the parent, leaving fdopen() where it was. -- http://ache.vniz.net/