[libvirt] (no subject)
Guido Günther
agx at sigxcpu.org
Wed Mar 9 12:25:23 UTC 2011
On Wed, Mar 09, 2011 at 12:12:22PM +0000, Daniel P. Berrange wrote:
> On Wed, Mar 09, 2011 at 09:17:56AM +0100, Guido Günther wrote:
> > >From 4a3765d97c3f5049aa294a4b7b629eabfd9cf04d Mon Sep 17 00:00:00 2001
> > From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx at sigxcpu.org>
> > Date: Mon, 7 Mar 2011 22:22:36 +0100
> > Subject: [PATCH 1/2] Move rundir creation into separate function
> >
> > ---
> > daemon/libvirtd.c | 31 ++++++++++++++++++++-----------
> > 1 files changed, 20 insertions(+), 11 deletions(-)
> >
> > diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
> > index 452566c..610e7fd 100644
> > --- a/daemon/libvirtd.c
> > +++ b/daemon/libvirtd.c
> > @@ -3150,6 +3150,24 @@ enum {
> > OPT_VERSION = 129
> > };
> >
> > +
> > +/* Ensure the rundir exists (on tmpfs on some systems) */
> > +static int create_rundir (void)
> > +{
> > + const char *rundir = LOCALSTATEDIR "/run/libvirt";
> > + int ret = 0;
> > +
> > + if (mkdir (rundir, 0755)) {
> > + if (errno != EEXIST) {
> > + char ebuf[1024];
> > + VIR_ERROR(_("unable to create rundir %s: %s"), rundir,
> > + virStrerror(errno, ebuf, sizeof(ebuf)));
> > + ret = VIR_DAEMON_ERR_RUNDIR;
> > + }
> > + }
> > + return ret;
> > +}
> > +
> > #define MAX_LISTEN 5
> > int main(int argc, char **argv) {
> > struct qemud_server *server = NULL;
> > @@ -3276,17 +3294,8 @@ int main(int argc, char **argv) {
> >
> > /* Ensure the rundir exists (on tmpfs on some systems) */
> > if (geteuid() == 0) {
> > - const char *rundir = LOCALSTATEDIR "/run/libvirt";
> > -
> > - if (mkdir (rundir, 0755)) {
> > - if (errno != EEXIST) {
> > - char ebuf[1024];
> > - VIR_ERROR(_("unable to create rundir %s: %s"), rundir,
> > - virStrerror(errno, ebuf, sizeof(ebuf)));
> > - ret = VIR_DAEMON_ERR_RUNDIR;
> > - goto error;
> > - }
> > - }
> > + if (create_rundir ())
> > + goto error;
> > }
> >
> > /* Beyond this point, nothing should rely on using
>
> NACK unless there's a compelling reason todo this now. The whole of
> libvirt.c is re-written in the RPC patch series I'm getting ready
> to repost
I did not want to add the resetting of the umask to several places
(followup patch). but I can do that if that's prefereable.
-- Guido
More information about the libvir-list
mailing list