]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
Initialize a pointer in split_init_cmd() to avoid gcc warnings
authorLeonid Isaev <leonid.isaev@jila.colorado.edu>
Thu, 21 Apr 2016 19:20:39 +0000 (13:20 -0600)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Fri, 22 Apr 2016 21:29:13 +0000 (16:29 -0500)
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 <leonid.isaev@jila.colorado.edu>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
src/lxc/lxccontainer.c

index 9f12ca2a0cd3f950ab5b98d4979da6908ba0e8cb..50cfc69ab775485403c83d2e4b35b1e09f89d97d 100644 (file)
@@ -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)