From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KyXkQ-00042T-Ki for qemu-devel@nongnu.org; Fri, 07 Nov 2008 15:16:02 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KyXkP-00040e-1d for qemu-devel@nongnu.org; Fri, 07 Nov 2008 15:16:02 -0500 Received: from [199.232.76.173] (port=58704 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KyXkO-00040S-Ph for qemu-devel@nongnu.org; Fri, 07 Nov 2008 15:16:00 -0500 Received: from rn-out-0910.google.com ([64.233.170.191]:7740) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KyXkO-0002F8-Ej for qemu-devel@nongnu.org; Fri, 07 Nov 2008 15:16:00 -0500 Received: by rn-out-0910.google.com with SMTP id m61so1138919rnd.8 for ; Fri, 07 Nov 2008 12:15:59 -0800 (PST) Message-ID: <4914A1FA.5000208@codemonkey.ws> Date: Fri, 07 Nov 2008 14:15:54 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] bug writing pidfile under unix (and fix) References: <20081107170215.7ca43a08@dgym.ktulu> <200811071756.12371.paul@codesourcery.com> In-Reply-To: <200811071756.12371.paul@codesourcery.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Jim Bailey Paul Brook wrote: > On Friday 07 November 2008, Jim Bailey wrote: > >> Hello, >> >> In qemu_create_pidfile (osdep.c:229) the current pid and a newline is >> written to the pidfile. However, the pidfile isn't truncated, so if it >> is longer than the length of the pid and the newline character you get >> trailing junk that can really mess up scripts. >> > > Shouldn't we just open with O_TRUNC ? > Definitely. > I also notice that we're not removing the file when we exit. > It's not terribly useful to remove the file but it couldn't hurt. An advisory lock is used to ensure that only one process is running at a given time. Regards, Anthony Liguori > Paul > > >