Fix warnings: shell.c: do_os_system(): Nonnull passed null: FP. #2923

Problem    : Argument with 'nonnull' attribute passed null @ 203.
Diagnostic : False positive.
Rationale  : Problem is supposed to appear when argv[0] is NULL within
             do_os_system. But argv is being generated by
             shell_build_argv(), which implies argv[0] is the current
             value for 'shell' option. Now, option has a non-null
             default ($SHELL or "sh"), and, if set by the user, it can
             be empty, but not NULL. So, argv[0] can never be NULL.
Resolution : Assert shell_build_argv() postcondition.
This commit is contained in:
Eliseo Martínez 2015-06-28 19:34:53 +02:00 committed by Justin M. Keyes
parent 957c81539f
commit f77f644998

View File

@ -63,6 +63,8 @@ char **shell_build_argv(const char *cmd, const char *extra_args)
rv[i] = NULL;
assert(rv[0]);
return rv;
}