Re: [PATCH vd_agent_linux v2 4/7] vdagent: Fix restarting agent

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@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;
>  }
> -- 
> 2.20.1
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/spice-devel

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]