From: Leonid Isaev Date: Thu, 21 Apr 2016 19:20:39 +0000 (-0600) Subject: Initialize a pointer in split_init_cmd() to avoid gcc warnings X-Git-Tag: lxc-2.1.0~441 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5590a671bce804b9f25765fdb1fc9cfcdae2c801;p=thirdparty%2Flxc.git 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 --- 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)