From owner-svn-src-head@freebsd.org Fri Nov 20 23:55:38 2015 Return-Path: Delivered-To: svn-src-head@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 69A2FA33CAA for ; Fri, 20 Nov 2015 23:55:38 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com [209.85.217.169]) (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 ECE891C9E for ; Fri, 20 Nov 2015 23:55:37 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: by lbbkw15 with SMTP id kw15so70543006lbb.0 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=BmLLqWpkHnkKszgSum91T7W5JJ74t3Fb1XLN88WERtry4hIP7xoDvpAWfOEr9x5wL9 M8BoLcJVEqHcB1QyDsjOSztAMjcK5Uw6QAX9r2T+vUkMqGr2LobDuCX9BmxiQipQWEOZ v9PmV8Y7UhFr92kD9MJjkG0ElrO8gZgk85efikoNHWSY80LkWbdFMQugSGPH2MPVNAHN GZS41Tc8DUdH2LPJgsiUwacEMIZILupIEArnSejciMHLskVPL5EdS9MeiTxTGN2R6PQ0 kikcViXItSPb0Arjp36vd9lzppl/fgHdRWRmeszXN2TFG/2XtOQB+R6dAR5ZgbWDWcRW eiSQ== X-Gm-Message-State: ALoCoQmzeKpB7nRNCpFKVngPhTURBbG2iYYkguqkpJST/vGn9JyFkc6QCc9cTwa6EmA5VU20j1YR 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-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Nov 2015 23:55:38 -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/