Skip to content

Commit 8e2b705

Browse files
nhormanLinus Torvalds
authored andcommitted
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>
1 parent 2a9807c commit 8e2b705

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎lib/argv_split.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ char **argv_split(gfp_t gfp, const char *str, int *argcp)
7575
if (argv == NULL)
7676
goto out;
7777

78-
*argcp = argc;
78+
if (argcp)
79+
*argcp = argc;
80+
7981
argvp = argv;
8082

8183
while (*str) {

0 commit comments

Comments
 (0)