[libvirt] [PATCH] logging: make VIR_ERROR and friends preserve errno
Jiri Denemark
jdenemar at redhat.com
Thu Feb 17 11:01:21 UTC 2011
> 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
More information about the libvir-list
mailing list