From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12273 invoked by alias); 10 Feb 2015 09:37:54 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 34491 Received: (qmail 4230 invoked from network); 10 Feb 2015 09:37:49 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_PASS autolearn=ham version=3.3.2 X-AuditID: cbfec7f5-b7fc86d0000066b7-6b-54d9d0d56cb6 Date: Tue, 10 Feb 2015 09:37:29 +0000 From: Peter Stephenson To: zsh workers Subject: Re: PATCH: Fix use-after-free for print -zf and print -sf Message-id: <20150210093729.476bab46@pwslap01u.europe.root.pri> In-reply-to: References: <1423552346-18827-1-git-send-email-mikachu@gmail.com> Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrGLMWRmVeSWpSXmKPExsVy+t/xq7pXL9wMMXh3Xd7iYPNDJgdGj1UH PzAFMEZx2aSk5mSWpRbp2yVwZUz8NJ+94Adrxft9b1kbGG+wdDFyckgImEisvnCHEcIWk7hw bz1bFyMXh5DAUkaJnttL2CGcJUwSJ+bsYAKpEhLYxijxsQvMZhFQlZg25zQbiM0mYCgxddNs sEkiQPHm7//ANggLOEksmdIMVs8rYC9x8PsqVhCbUyBYYuHjRUwQCzoYJW7feQTWzC+gL3H1 7ycmiJPsJWZeOcMI0Swo8WPyPbChzAJaEpu3NbFC2PISm9e8ZYY4Tl3ixt3d7BMYhWYhaZmF pGUWkpYFjMyrGEVTS5MLipPSc430ihNzi0vz0vWS83M3MULC9usOxqXHrA4xCnAwKvHwXrhy I0SINbGsuDL3EKMEB7OSCK/ovJshQrwpiZVVqUX58UWlOanFhxiZODilGhj1pgXf+jlXQGPV glq/HO/CXSsbVl/9bGyfVTGN56XqrM25ATIiK6IaVV+WqLP941SV7al82Z706anX/oMX0taU yx2eLRHrcdqvOFiIPTj/X0lG+P8W+QWXzHMSu+rLYtrac+/LLH5uoPr0YFEud8QWCbNlN25M Wr31+OLVuzUcplc5Nk+NWK/EUpyRaKjFXFScCACNMfp7OQIAAA== On Tue, 10 Feb 2015 08:16:56 +0100 Mikael Magnusson wrote: > On Tue, Feb 10, 2015 at 8:12 AM, Mikael Magnusson wrote: > > /* Testing EBADF special-cases >&- redirections */ > > - if ((fout != stdout) ? (fclose(fout) != 0) : > > + if (fout && (fout != stdout) ? (fclose(fout) != 0) : > > Do I need an extra set of parens here? C precedence rules are fun. > https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B#Operator_precedence "&&" is higher precedence than && so this looks OK. I suppose it's at the point where a lot of people would decide it needed expanding into something clearer, but it's a reasonable extension of what was there before. Can't see a problem with it. pws