These patches started out as a more "correct" fix for the patch
https://www.redhat.com/archives/libvir-list/2010-July/msg00257.html
(and they supercede that patch).
Daniel Berrange suggested that it would be better to switch the
function virFileOperation over to use the preferred convention of
returning -errno on failure, rather than errno. While I was doing
that, I also changed virDirCreate for consistency.
During this process, I found one bug (in patch 4/4) and made a slight
improvement to another function's return so that virFileOperation's
return would always be -errno (rather than sometimes being a simple
-1). (patch 3/4)