On Mon, Mar 02, 2020 at 05:47:45PM +0000, Daniel P. Berrangé wrote: > On Mon, Mar 02, 2020 at 06:36:13PM +0100, Philippe Mathieu-Daudé wrote: > > typo "multi" in patch subject. > > Thank Philippe, will fix. > > On 2/24/20 9:55 PM, Jagannathan Raman wrote: > > > From: Elena Ufimtseva <elena.ufimts...@oracle.com> > > > > > > Signed-off-by: Elena Ufimtseva <elena.ufimts...@oracle.com> > > > Signed-off-by: Jagannathan Raman <jag.ra...@oracle.com> > > > Signed-off-by: John G Johnson <john.g.john...@oracle.com> > > > --- > > > v4 -> v5: > > > - Added "exec" suboption to get the executable's name > > > - Addressed feedback about variable names > > > - Removed redundant check for spawning a process > > > > > > hw/proxy/qemu-proxy.c | 68 > > > +++++++++++++++++++++++++++++++++---------- > > > include/hw/proxy/qemu-proxy.h | 2 +- > > > 2 files changed, 54 insertions(+), 16 deletions(-) > > > > > > diff --git a/hw/proxy/qemu-proxy.c b/hw/proxy/qemu-proxy.c > > > index 828bbd7..d792e86 100644 > > > --- a/hw/proxy/qemu-proxy.c > > > +++ b/hw/proxy/qemu-proxy.c > > > @@ -19,19 +19,50 @@ > > > static void pci_proxy_dev_realize(PCIDevice *dev, Error **errp); > > > +static int add_argv(char *opts_str, char **argv, int argc) > > > +{ > > > + int max_args = 64; > > > + > > > + if (argc < max_args - 1) { > > > + argv[argc++] = opts_str; > > > + argv[argc] = 0; > > > + } else { > > > + return 0; > > > + } > > > + > > > + return argc; > > > +} > > > + > > > +static int make_argv(char *opts_str, char **argv, int argc) > > > +{ > > > + int max_args = 64; > > > + > > > + char *p2 = strtok(opts_str, " "); > > > + while (p2 && argc < max_args - 1) { > > > + argv[argc++] = p2; > > > + p2 = strtok(0, " "); > > > + } > > > + argv[argc] = 0; > > > > Is there a GLib function to do that? >
Hi Daniel > g_shell_parse_argv() perhaps > Thanks for the suggestion. > https://developer.gnome.org/glib/stable/glib-Shell-related-Utilities.html > > > Though my preference would be to avoid the need to do this at all, by > not accepting a raw shell command line string in the first place. > Can you please clarify? Did you mean that it would be better if Qemu somehow verifies the options and then passes it to a remote process via a message? Thanks! Elena > > Regards, > Daniel > -- > |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| > |: https://libvirt.org -o- https://fstop138.berrange.com :| > |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| >