enter: Make it clearer that rest_argv_start always gets initialized

scan-build complained that rest_argv_start could be used uninitialized,
because it can't see that rest_argc >= 2 implies that rest_argv_start
got initialized at the same time rest_argc was set. Make this easier
to understand.

Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
Simon McVittie
2021-04-16 10:53:07 +01:00
committed by Alexander Larsson
parent bd5c2762cf
commit 12d7855493

View File

@@ -89,6 +89,8 @@ flatpak_builtin_enter (int argc,
g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
rest_argc = 0;
rest_argv_start = 0;
for (i = 1; i < argc; i++)
{
/* The non-option is the command, take it out of the arguments */
@@ -110,6 +112,9 @@ flatpak_builtin_enter (int argc,
return FALSE;
}
/* If this wasn't true, rest_argc would still be 0 */
g_assert (rest_argv_start >= 1);
pid_s = argv[rest_argv_start];
pid = atoi (pid_s);