On Tue, 25 Oct 2022 22:27:36 +0200
Paolo Bonzini <pbonz...@redhat.com> wrote:

> Il mar 25 ott 2022, 16:39 Greg Kurz <gr...@kaod.org> ha scritto:
> 
> > > > -    if (logfile && (!need_to_open_file || changed_name)) {
> > > > -        qatomic_rcu_set(&global_file, NULL);
> >
> > Hmm... wait, shouldn't this NULLifying be performed...
> >
> > > > -        if (logfile != stderr) {
> > > > +    if (logfile) {
> > > > +        fflush(logfile);
> > > > +        if (changed_name && logfile != stderr) {
> > > >              RCUCloseFILE *r = g_new0(RCUCloseFILE, 1);
> > > >              r->fd = logfile;
> >
> >
> > ... here since we the following closes the global_file ?
> >
> > > >              call_rcu(r, rcu_close_file, rcu);
> >
> 
> Yes it should.
> 

I'll fix this when I repost the full series.

Cheers,

--
Greg


> Paolo
> 
> > > +            logfile = NULL;
> > > >          }
> > > > -        logfile = NULL;
> > > >      }
> > > >
> > > >      if (!logfile && need_to_open_file) {
> > > >          if (filename) {
> > > > -            logfile = fopen(filename, log_append ? "a" : "w");
> > > > +            logfile = fopen(filename, "w");
> > > >              if (!logfile) {
> > > >                  error_setg_errno(errp, errno, "Error opening logfile
> > %s",
> > > >                                   filename);
> > > > @@ -290,8 +289,6 @@ static bool qemu_set_log_internal(const char
> > *filename, bool changed_name,
> > > >              logfile = stderr;
> > > >          }
> > > >
> > > > -        log_append = 1;
> > > > -
> > > >          qatomic_rcu_set(&global_file, logfile);
> > > >      }
> > > >      return true;
> > >
> > >
> >
> >


Reply via email to