> > On Fri, Jan 04, 2019 at 08:37:02AM +0000, Frediano Ziglio wrote: > > We need to pass original argument list, however argv is modified by > > "the original argument list.." > > > g_option_context_parse so save a copy of the array to make possible > > to restart with the same arguments. > > "to make it possible" > > Did you observe issues without that? > Yes and not. I instrumented the code to see how the argument list change. GLib strips all options, for instance passing "-o 1" main get called with ["spice-vdagent", "-o", "1"], after the parse argv contains ["spice-vdagent"] so next executable would be called without options. > Acked-by: Christophe Fergeau <cfergeau@xxxxxxxxxx> > > > > > Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx> > > --- > > src/vdagent/vdagent.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/src/vdagent/vdagent.c b/src/vdagent/vdagent.c > > index eb741bc..0916029 100644 > > --- a/src/vdagent/vdagent.c > > +++ b/src/vdagent/vdagent.c > > @@ -418,6 +418,7 @@ int main(int argc, char *argv[]) > > GOptionContext *context; > > GError *error = NULL; > > VDAgent *agent; > > + char **orig_argv = g_memdup(argv, sizeof(char*) * (argc+1)); > > > > context = g_option_context_new(NULL); > > g_option_context_add_main_entries(context, entries, NULL); > > @@ -465,7 +466,7 @@ reconnect: > > if (version_mismatch) { > > syslog(LOG_INFO, "Version mismatch, restarting"); > > sleep(1); > > - execvp(argv[0], argv); > > + execvp(orig_argv[0], orig_argv); > > } > > > > agent = vdagent_new(); > > @@ -483,6 +484,7 @@ reconnect: > > g_free(fx_dir); > > g_free(portdev); > > g_free(vdagentd_socket); > > + g_free(orig_argv); > > > > return 0; > > } _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel