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

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



On 02/15/2011 07:33 PM, 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?

Yeah, that's just going a step further than what I did in commit 17e19add "Preserve errno across calls to error reporting functions & VIR_FREE". Since there are cases when we want to report an error, but not count it as an "error", that makes sense (also it makes a lot of sense that instrumentation for debugging should be as non-intrusive as possible).


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