Skip to content

Commit

Permalink
argv_split: allow argv_split to handle NULL pointer in argcp paramete…
Browse files Browse the repository at this point in the history
…r 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>
  • Loading branch information
Neil Horman authored and Linus Torvalds committed Oct 17, 2007
1 parent 2a9807c commit 8e2b705
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/argv_split.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 8e2b705

Please sign in to comment.