[lxc-devel] [PATCH 3/3] Do not pass global variable as pointer

Stéphane Graber stgraber at ubuntu.com
Tue Nov 17 16:35:27 UTC 2015


Note that I'm applying the other two but not this one due to missing ack
from Serge as he noticed that leftover debugging.

On Mon, Nov 09, 2015 at 11:34:20PM +0000, Serge Hallyn wrote:
> Quoting Christian Brauner (christian.brauner at mailbox.org):
> > Signed-off-by: Christian Brauner <christian.brauner at mailbox.org>
> > ---
> >  src/lxc/lxc_copy.c | 18 +++++++++---------
> >  1 file changed, 9 insertions(+), 9 deletions(-)
> > 
> > diff --git a/src/lxc/lxc_copy.c b/src/lxc/lxc_copy.c
> > index e5f52d2..791d7a2 100644
> > --- a/src/lxc/lxc_copy.c
> > +++ b/src/lxc/lxc_copy.c
> > @@ -123,8 +123,7 @@ Options :\n\
> >  	.daemonize = 1,
> >  };
> >  
> > -static struct mnts *add_mnt(struct mnts **mnts, unsigned int *num,
> > -			    enum mnttype type);
> > +static struct mnts *add_mnt(struct mnts **mnts, enum mnttype type);
> >  static int mk_rand_ovl_dirs(struct mnts *mnts, struct lxc_arguments *my_args);
> >  static char *construct_path(char *path, bool as_prefix);
> >  static char *set_mnt_entry(struct mnts *m);
> > @@ -211,17 +210,17 @@ int main(int argc, char *argv[])
> >  	exit(EXIT_FAILURE);
> >  }
> >  
> > -static struct mnts *add_mnt(struct mnts **mnts, unsigned int *num, enum mnttype type)
> > +static struct mnts *add_mnt(struct mnts **mnts, enum mnttype type)
> >  {
> >  	struct mnts *m, *n;
> >  
> > -	n = realloc(*mnts, (*num + 1) * sizeof(struct mnts));
> > +	n = realloc(*mnts, (num + 1) * sizeof(struct mnts));
> >  	if (!n)
> >  		return NULL;
> >  
> >  	*mnts = n;
> > -	m = *mnts + *num;
> > -	(*num)++;
> > +	m = *mnts + num;
> > +	num++;
> >  
> >  	*m = (struct mnts) {.type = type};
> >  
> > @@ -401,6 +400,7 @@ static int do_clone_ephemeral(struct lxc_container *c,
> >  		goto err;
> >  
> >  	/* allocate and set mount entries */
> > +	printf("%u\n", num);
> 
> left-over debugging?
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel

-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20151117/af5a065e/attachment.sig>


More information about the lxc-devel mailing list