From: Dwight Engen Date: Fri, 17 May 2013 21:40:12 +0000 (-0400) Subject: quiet gcc 4.4.7 warning about saveptr use before initialization X-Git-Tag: lxc-1.0.0.alpha1~1^2~204 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=40650ea6817286a9587a84bf3ce5d25d10620303;p=thirdparty%2Flxc.git quiet gcc 4.4.7 warning about saveptr use before initialization Signed-off-by: Dwight Engen Signed-off-by: Serge Hallyn --- diff --git a/src/lxc/cgroup.c b/src/lxc/cgroup.c index a8ae8c1a5..c2f0a2da4 100644 --- a/src/lxc/cgroup.c +++ b/src/lxc/cgroup.c @@ -551,7 +551,7 @@ out: static int in_cgroup_list(char *s, char *list) { - char *token, *str, *saveptr; + char *token, *str, *saveptr = NULL; if (!list || !s) return 0; @@ -566,7 +566,7 @@ static int in_cgroup_list(char *s, char *list) static int have_visited(char *opts, char *visited, char *allcgroups) { - char *str, *s, *token; + char *str, *s = NULL, *token; for (str = strdupa(opts); (token = strtok_r(str, ",", &s)); str = NULL) { if (!in_cgroup_list(token, allcgroups)) @@ -580,7 +580,7 @@ static int have_visited(char *opts, char *visited, char *allcgroups) static int record_visited(char *opts, char **visitedp, char *allcgroups) { - char *s, *token, *str; + char *s = NULL, *token, *str; int oldlen, newlen, ret; for (str = strdupa(opts); (token = strtok_r(str, ",", &s)); str = NULL) {