qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] bug writing pidfile under unix (and fix)


From: Jim Bailey
Subject: Re: [Qemu-devel] bug writing pidfile under unix (and fix)
Date: Fri, 7 Nov 2008 20:33:23 +0000

On Fri, 07 Nov 2008 14:15:54 -0600
Anthony Liguori <address@hidden> wrote:

> 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.

No no no, definitely not, please see my earlier comment.

We don't want to wipe the contents of the file until AFTER checking the
advisory lock.

Regards,

dgym


> 
> > 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
> >
> >
> >   
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]