summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2021-04-16 10:53:07 +0100
committerAlexander Larsson <alexander.larsson@gmail.com>2021-04-19 09:09:04 +0200
commit12d7855493b456dffb63ba5edd4f9cf02028e319 (patch)
tree5db906be92dff91ecc64ea63f142455dde088e84
parentbd5c2762cf43c441cd0e5d0a9684bf41f16dbbbd (diff)
downloadflatpak-12d7855493b456dffb63ba5edd4f9cf02028e319.tar.gz
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>
-rw-r--r--app/flatpak-builtins-enter.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/flatpak-builtins-enter.c b/app/flatpak-builtins-enter.c
index de7a0318..44e14e9b 100644
--- a/app/flatpak-builtins-enter.c
+++ b/app/flatpak-builtins-enter.c
@@ -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);