In virFileOperation, the parent does a fallback to a non-fork
attempt if it detects that the child returned EACCES.  However,
the child was calling _exit(-EACCESS), which does _not_ appear
as EACCES in the parent.

* src/util/util.c (virFileOperation): Correctly pass EACCES from
child to parent.
---
 src/util/util.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/util/util.c b/src/util/util.c
index bac71c8..0fe1c41 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -1559,6 +1559,15 @@ parenterror:
         goto childerror;
     }
 childerror:
+    /* Hook sets ret to -errno on failure, but exit must be positive.
+     * If we exit with EACCES, then parent tries again.  */
+    /* XXX This makes assumptions about errno being < 255, which is
+     * not true on Hurd.  */
+    ret = -ret;
+    if ((ret & 0xff) != ret) {
+        VIR_WARN("unable to pass desired return value %d", ret);
+        ret = 0xff;
+    }
     _exit(ret);

 }
-- 
1.7.4

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

Reply via email to