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

Re: [libvirt] [PATCH] cgroup: preserve correct errno on failure



On Tue, Feb 15, 2011 at 05:33:09PM -0700, Eric Blake wrote:
> On 02/15/2011 05:01 PM, Eric Blake wrote:
> > * src/util/cgroup.c (virCgroupSetValueStr, virCgroupGetValueStr)
> > (virCgroupRemoveRecursively): VIR_DEBUG can clobber errno.
> > (virCgroupRemove): Use VIR_DEBUG rather than DEBUG.
> > ---
> 
> >      rc = virFileWriteStr(keypath, value, 0);
> >      if (rc < 0) {
> > -        DEBUG("Failed to write value '%s': %m", value);
> >          rc = -errno;
> > +        VIR_DEBUG("Failed to write value '%s': %m", value);
> 
> Should we go one step further and guarantee that VIR_DEBUG() does not
> modify errno?

  We should probably do this, basically in virLogMessage() save and restore
errno so that even INFO or WARN don't change it if activated, but I would
do this as a post 0.8.8 :-)

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/


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