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 <leonid.isaev@jila.colorado.edu>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
This commit is contained in:
Leonid Isaev 2016-04-21 13:20:39 -06:00 committed by Serge Hallyn
parent 1ee85fbcc4
commit 5590a671bc

View 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)