From: Neil Horman Date: Wed, 17 Oct 2007 06:26:33 +0000 (-0700) Subject: argv_split: allow argv_split to handle NULL pointer in argcp parameter gracefully X-Git-Tag: v2.6.24-rc1~735 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=8e2b705649e294f43a8cd1ea79e4c594c0bd1d9d;p=linux-2.6-omap-h63xx.git argv_split: allow argv_split to handle NULL pointer in argcp parameter gracefully It would be nice if the argv_split library function could gracefully handle a NULL pointer in the argcp parameter, so as to allow functions using it that did not care about the value of argc to not have to declare a useless variable. This patch accomplishes that. Tested by me, with successful results. Signed-off-by: Neil Horman Acked-by: Jeremy Fitzhardinge Cc: Satyam Sharma Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/lib/argv_split.c b/lib/argv_split.c index 4096ed42f49..fad6ce4f7b5 100644 --- a/lib/argv_split.c +++ b/lib/argv_split.c @@ -75,7 +75,9 @@ char **argv_split(gfp_t gfp, const char *str, int *argcp) if (argv == NULL) goto out; - *argcp = argc; + if (argcp) + *argcp = argc; + argvp = argv; while (*str) {