summaryrefslogtreecommitdiff
path: root/lib/argv_split.c
diff options
context:
space:
mode:
authorNeil Horman <nhorman@tuxdriver.com>2007-10-16 23:26:33 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-17 08:42:50 -0700
commit8e2b705649e294f43a8cd1ea79e4c594c0bd1d9d (patch)
treeedceaa54f86252ea66f3321786cd89771759dbfd /lib/argv_split.c
parent2a9807c0d39066236640aa34ca8de168e690632f (diff)
downloadlinux-3.10-8e2b705649e294f43a8cd1ea79e4c594c0bd1d9d.tar.gz
linux-3.10-8e2b705649e294f43a8cd1ea79e4c594c0bd1d9d.tar.bz2
linux-3.10-8e2b705649e294f43a8cd1ea79e4c594c0bd1d9d.zip
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 <nhorman@tuxdriver.com> Acked-by: Jeremy Fitzhardinge <jeremy@goop.org> Cc: Satyam Sharma <satyam@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib/argv_split.c')
-rw-r--r--lib/argv_split.c4
1 files changed, 3 insertions, 1 deletions
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) {