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

Re: [libvirt] [PATCH] logging: make VIR_ERROR and friends preserve errno



> Followup to commit 17e19add, and would have prevented the bug
> independently fixed in commit 76c57a7c.
> 
> * src/util/logging.c (virLogMessage): Preserve errno, since
> logging should be as unintrusive as possible.
...
> -    if (fmt == NULL)
> -       return;
> +    if (fmt == NULL) {
> +        errno = saved_errno;
> +        return;
> +    }
...
>      virLogUnlock();
> 
>      VIR_FREE(msg);
> +    errno = saved_errno;
>  }

I would have implemented this as

     if (...)
-        return;
+        goto out;

...

     VIR_FREE(msg);
+
+out:
+    errno = saved_errno;
 }

to avoid having to set errno in several places but I can live with your
solution too :-)

ACK regardless on which one of the two versions you decide to push.

Jirka


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