From owner-cvs-src@FreeBSD.ORG Mon Dec 17 09:06:04 2007 Return-Path: Delivered-To: cvs-src@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2F3E516A41B; Mon, 17 Dec 2007 09:06:04 +0000 (UTC) (envelope-from dds@aueb.gr) Received: from mx-out-01.forthnet.gr (mx-out.forthnet.gr [193.92.150.104]) by mx1.freebsd.org (Postfix) with ESMTP id 9F0AD13C447; Mon, 17 Dec 2007 09:06:03 +0000 (UTC) (envelope-from dds@aueb.gr) Received: from mx-av-01.forthnet.gr (mx-av.forthnet.gr [193.92.150.27]) by mx-out-01.forthnet.gr (8.13.8/8.13.8) with ESMTP id lBH960mg018315; Mon, 17 Dec 2007 11:06:00 +0200 Received: from MX-IN-01.forthnet.gr (mx-in-01.forthnet.gr [193.92.150.23]) by mx-av-01.forthnet.gr (8.14.1/8.14.1) with ESMTP id lBH95x6k032032; Mon, 17 Dec 2007 11:06:00 +0200 Received: from [192.168.136.22] (ppp238-249.adsl.forthnet.gr [77.49.17.249]) by MX-IN-01.forthnet.gr (8.14.2/8.14.2) with ESMTP id lBH95vKd008027; Mon, 17 Dec 2007 11:05:59 +0200 Authentication-Results: MX-IN-01.forthnet.gr smtp.mail=dds@aueb.gr; spf=neutral Authentication-Results: MX-IN-01.forthnet.gr header.from=dds@aueb.gr; sender-id=neutral Message-ID: <47663BE3.6050401@aueb.gr> Date: Mon, 17 Dec 2007 11:05:39 +0200 From: Diomidis Spinellis User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4) Gecko/20070509 SeaMonkey/1.1.2 MIME-Version: 1.0 To: Alfred Perlstein References: <200712161747.lBGHlYk9093518@repoman.freebsd.org> <20071217062046.GE16982@elvis.mu.org> In-Reply-To: <20071217062046.GE16982@elvis.mu.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: cvs-src@FreeBSD.ORG, src-committers@FreeBSD.ORG, Diomidis Spinellis , cvs-all@FreeBSD.ORG Subject: Re: cvs commit: src/bin/mv mv.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2007 09:06:04 -0000 Alfred Perlstein wrote: > * Diomidis Spinellis [071216 09:47] wrote: >> dds 2007-12-16 17:47:34 UTC >> >> FreeBSD src repository >> >> Modified files: >> bin/mv mv.c >> Log: >> Eliminate gcc "variable clobbered" warnings by declaring the variables >> living across the vfork as volatile. >> >> Noted by: kan >> >> Revision Changes Path >> 1.48 +2 -1 src/bin/mv/mv.c > > I'm pretty sure that calling warn(3) under vfork() is not allowed > as it can clobber stdio state. > > To fix this, have the parent catch a return value from the child > and emit the warning. This has been there since (at least) 1994, but you're absolutely right. POSIX states: "[...] the behavior is undefined if the process created by vfork() either modifies any data other than a variable of type pid_t used to store the return value from vfork(), or returns from the function in which vfork() was called, or calls any other function before successfully calling _exit() or one of the exec family of functions." I've fixed it in the way you suggested. -- Diomidis Spinellis