From f77f64499830988a14c029bb6436afa4a4386d1e Mon Sep 17 00:00:00 2001 From: Eliseo Martínez Date: Sun, 28 Jun 2015 19:34:53 +0200 Subject: 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. --- src/nvim/os/shell.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c index 5859254c1b..2de3b1aeed 100644 --- a/src/nvim/os/shell.c +++ b/src/nvim/os/shell.c @@ -63,6 +63,8 @@ char **shell_build_argv(const char *cmd, const char *extra_args) rv[i] = NULL; + assert(rv[0]); + return rv; } -- cgit