From 5590a671bce804b9f25765fdb1fc9cfcdae2c801 Mon Sep 17 00:00:00 2001 From: Leonid Isaev Date: Thu, 21 Apr 2016 13:20:39 -0600 Subject: [PATCH] Initialize a pointer in split_init_cmd() to avoid gcc warnings gcc -Wall warns about uninitialized variables (-Wmaybe-uninitialized), and -Werror makes it fatal. This change allows the build to succeed by NULL'ifying the pointer passed to strtok_r(). Note that strtok_r(3) anyway ignores a non-NULL arg3 pointer on the 1st call with non-NULL arg1 string. Signed-off-by: Leonid Isaev Acked-by: Serge Hallyn --- src/lxc/lxccontainer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c index 9f12ca2a0..50cfc69ab 100644 --- a/src/lxc/lxccontainer.c +++ b/src/lxc/lxccontainer.c @@ -670,7 +670,7 @@ static char **split_init_cmd(const char *incmd) { size_t len; int nargs = 0; - char *copy, *p, *saveptr; + char *copy, *p, *saveptr = NULL; char **argv; if (!incmd)