[lxc-users] Failure to compile with gcc 4.9.0 due to -Werror=maybe-unitialized
Stéphane Graber
stgraber at ubuntu.com
Wed Jun 18 02:58:43 UTC 2014
On Tue, Jun 17, 2014 at 10:21:47PM -0400, Leonid Isaev wrote:
> Hi,
>
> On Tue, Jun 17, 2014 at 03:44:23AM +0000, Serge Hallyn wrote:
> > Date: Tue, 17 Jun 2014 03:44:23 +0000
> > From: Serge Hallyn <serge.hallyn at ubuntu.com>
> > To: lxc-users at lists.linuxcontainers.org
> > Subject: Re: [lxc-users] Failure to compile with gcc 4.9.0 due to
> > -Werror=maybe-unitialized
> > User-Agent: Mutt/1.5.21 (2010-09-15)
> >
> >
> > The compiler is being stupid, but if it's causing you trouble feel
> > feel free to send a patch to initialize saveptr to NULL.
> >
>
> I am attaching the patch which fixes the build for me. I'm not sure that you
> want to apply it though, given that only Archlinux seems to be affected at the
> moment...
>
> Thanks,
> --
> Leonid Isaev
> GPG fingerprints: DA92 034D B4A8 EC51 7EA6 20DF 9291 EE8A 043C B8C4
> C0DF 20D0 C075 C3F1 E1BE 775A A7AE F6CB 164B 5A6D
> From: Leonid Isaev <lisaev at umail.iu.edu>
> Date: Wed, 18 Jun 2014 00:21:25 +0000
> Subject: [PATCH] bdev.c: initialize a pointer to avoid build failures with
> -Werror=maybe-uninitialized
>
> Signed-off-by: Leonid Isaev <lisaev at umail.iu.edu>
Acked-by: Stéphane Graber <stgraber at ubuntu.com>
> ---
> src/lxc/bdev.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/lxc/bdev.c b/src/lxc/bdev.c
> index c0051e6..2ed0b96 100644
> --- a/src/lxc/bdev.c
> +++ b/src/lxc/bdev.c
> @@ -3097,7 +3097,7 @@ struct bdev *bdev_create(const char *dest, const char *type,
>
> // -B lvm,dir
> if (index(type, ',') != NULL) {
> - char *dup = alloca(strlen(type)+1), *saveptr, *token;
> + char *dup = alloca(strlen(type)+1), *saveptr = NULL, *token;
> strcpy(dup, type);
> for (token = strtok_r(dup, ",", &saveptr); token;
> token = strtok_r(NULL, ",", &saveptr)) {
> --
> 2.0.0
>
> _______________________________________________
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users
--
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-users/attachments/20140617/3e00f845/attachment.sig>
More information about the lxc-users
mailing list