[Spice-devel] [PATCH vd_agent_linux v2 4/7] vdagent: Fix restarting agent
Christophe Fergeau
cfergeau at redhat.com
Fri Jan 4 10:21:10 UTC 2019
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?
Acked-by: Christophe Fergeau <cfergeau at redhat.com>
>
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
> 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;
> }
> --
> 2.20.1
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20190104/900b9cc8/attachment.sig>
More information about the Spice-devel
mailing list