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

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

 



> 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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]