Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8e2b7056 authored by Neil Horman's avatar Neil Horman Committed by Linus Torvalds
Browse files

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: default avatarNeil Horman <nhorman@tuxdriver.com>
Acked-by: default avatarJeremy Fitzhardinge <jeremy@goop.org>
Cc: Satyam Sharma <satyam@infradead.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 2a9807c0
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -75,7 +75,9 @@ char **argv_split(gfp_t gfp, const char *str, int *argcp)
	if (argv == NULL)
		goto out;

	if (argcp)
		*argcp = argc;

	argvp = argv;

	while (*str) {