[Libvir] [patch 9/9] Implement better error reporting
Mark McLoughlin
markmc at redhat.com
Mon Feb 19 18:00:13 UTC 2007
Hey,
On Fri, 2007-02-16 at 19:28 +0000, Daniel P. Berrange wrote:
> On Fri, Feb 16, 2007 at 02:44:57PM +0000, Mark McLoughlin wrote:
> > @@ -289,29 +375,38 @@ static int qemudListen(struct qemud_serv
> > int uid;
> >
> > if ((uid = geteuid()) < 0) {
> > + qemudLog(QEMUD_ERR, "You must run the daemon as root to use system mode");
> > return -1;
> > }
>
> This error message looks bogus. This codepath is the per-user unprivileged
> session mode, and the error. And actually checking return value at all is
> completely unneccesssary because geteuid() is guarenteed not to fail.
>
> We do, however, need a check
>
> if (geteuid() != 0) {
> ....
> }
>
> In the first half of the if() block in the qemudListen function to check for
> root privs in system mode.
Okay, here's an attempt to clean up all this code - mostly to coalesce
the two system vs. user code paths into a single function, but also to
recursively create config dirs and fix up the problems you spotted.
Cheers,
Mark.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libvirt-geteuid-error-handling.patch
Type: text/x-patch
Size: 7427 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20070219/da82500c/attachment-0001.bin>
More information about the libvir-list
mailing list